From 70c994b5e549b7fc2e167130c7f3e7b171131000 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 18 Jul 2020 09:51:01 +0100 Subject: Map: import feature settings --- bh20simplewebuploader/static/map.js | 43 +++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'bh20simplewebuploader/static') diff --git a/bh20simplewebuploader/static/map.js b/bh20simplewebuploader/static/map.js index 1003f7d..8a1d5ac 100644 --- a/bh20simplewebuploader/static/map.js +++ b/bh20simplewebuploader/static/map.js @@ -29,11 +29,46 @@ function drawMap(){ -/* This function updates the map with markers - * -*/ + +/* + * This function updates the map with markers + */ + function updateMapMarkers(data) { - let markers = L.markerClusterGroup(); + let markers = L.markerClusterGroup({ + + iconCreateFunction: function (cluster) { + var theseMarkers = cluster.getAllChildMarkers(); //// -- this is the array of each marker in the cluster. + + sumCount = 0; + for (var i = 0; i < theseMarkers.length; i++) { + // sumCount += theseMarkers[i].feature.properties.Confirmed; + sumCount += 1; + } + + var digits = (sumCount + '').length; + + return L.divIcon({ + html: sumCount, + className: 'cluster digits-' + digits, + iconSize: null + }); + }, + + pointToLayer: function (feature, latlng) { + return L.circleMarker(latlng, { + opacity: 1, + color: getSColor(feature.properties.Confirmed), + weight: getSwieght(feature.properties.Confirmed), + fillColor: getColor(feature.properties.Confirmed), + fillOpacity: .3, + radius: getRad(feature.properties.Confirmed), + pane: 'circlesIIOM' + }); + + }, + + }); for (let i = 0; i < data.length; i++) { let {"count": fastaCount, GPS, LocationLabel: label } = data[i]; let coordinates = GPS.split(" "); -- cgit v1.2.3