From fdb534f551e11ba5d43bec4aeba2bab4d141700b Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Fri, 17 Jul 2020 10:31:34 +0100
Subject: Using mapcluster again
---
bh20simplewebuploader/static/map.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'bh20simplewebuploader')
diff --git a/bh20simplewebuploader/static/map.js b/bh20simplewebuploader/static/map.js
index e877454..36208b5 100644
--- a/bh20simplewebuploader/static/map.js
+++ b/bh20simplewebuploader/static/map.js
@@ -10,7 +10,6 @@ L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
subdomains: ['a','b','c']
}).addTo(map);
-// var markers = L.markerClusterGroup().addTo(mapid)
function drawMap(){
var mymap = map;
@@ -45,6 +44,7 @@ function drawMap(){
*
*/
function updateMapMarkers(data) {
+ let markers = L.markerClusterGroup();
for (let i = 0; i < data.length; i++) {
let {"count": fastaCount, GPS, LocationLabel: label } = data[i];
let coordinates = GPS.split(" ");
@@ -52,8 +52,10 @@ function updateMapMarkers(data) {
let lat, lon;
[lon, lat] = coordinates.map(parseFloat);
let point = L.point()
- L.marker([lat, lon]).addTo(map)
- .bindPopup("" + label + "
" + "FastaCount: " +fastaCount);
+ marker = (L.marker([lat, lon]));
+ // .bindPopup("" + label + "
" + "FastaCount: " +fastaCount));
+ markers.addLayer(marker);
}
}
+ map.addLayer(markers);
}
--
cgit v1.2.3