HeatMap Router and HeatMap User

parent 29753b2c
......@@ -195,7 +195,7 @@ function prepareIcon()
});
var icon_off = L.icon({
iconUrl: 'https://www.freifunk-karte.de/img/hotspot_offline.png',
iconUrl:'https://www.freifunk-karte.de/img/hotspot_offline.png',
iconSize: [42, 27], // size of the icon
iconAnchor: [21, 13], // point of the icon which will correspond to marker's location
popupAnchor: [0, -9] // point from which the popup should open relative to the iconAnchor
......@@ -220,6 +220,15 @@ function addPoints2Map(data)
});
var heatMapData = [];
var heatmapUserLayer = new HeatmapOverlay({
"radius": 50,
"scaleRadius": false,
"useLocalExtrema": false,
"valueField": 'count'
});
var heatMapUserData = [];
// add all entries to clustergroup and heatmap
$.each(data, function(i, router)
{
......@@ -229,6 +238,12 @@ function addPoints2Map(data)
count: 1.1
});
heatMapUserData.push({
lat: router.lat,
lng: router.long,
count: router.clients
});
var marker = new PruneCluster.Marker(router.lat, router.long);
marker.category = 0;
......@@ -261,12 +276,19 @@ function addPoints2Map(data)
data: heatMapData
});
map.addLayer(heatmapUserLayer);
heatmapUserLayer.setData({
max: 1,
data: heatMapUserData
});
var layers = {
// add the cluster layer
"Nodes": pruneCluster,
// add the heatmap layer
"HeatMap": heatmapLayer
"HeatMap Router": heatmapLayer,
"HeatMap User": heatmapUserLayer
};
var selectedLayers = getURLParameter('l');
......@@ -274,6 +296,7 @@ function addPoints2Map(data)
if(selectedLayers)
{
// layers have been preselected in the url
selectedLayers = selectedLayers.replace(/%20/g,' ');
selectedLayers = selectedLayers.split('|');
$.each(layers, function(key, layer)
......@@ -292,6 +315,7 @@ function addPoints2Map(data)
{
// hide heatmap layer by default
map.removeLayer(heatmapLayer);
map.removeLayer(heatmapUserLayer);
}
// add layer controls for all layers
......@@ -351,8 +375,6 @@ function getTooltipContent(routerData)
tooltip += 'verbundene Clients: '+routerData.clients+'<br />';
}
tooltip += '<h4 class="comm" title="Geo"><a href="Geo:0,0?q='+routerData.lat+','+routerData.long+'('+routerData.name+')" target="community_netmon">Hierhin navigieren</a></h4>';
if(routerData.status != 'online' && routerData.status != '?')
{
tooltip += '<span class="errorNote">Router ist offline !</span>';
......@@ -621,4 +643,4 @@ function preparePruneCluster()
pruneCluster.Cluster.Size = 100;
return pruneCluster;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment