diff options
Diffstat (limited to 'bh20simplewebuploader/static/map.js')
-rw-r--r-- | bh20simplewebuploader/static/map.js | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/bh20simplewebuploader/static/map.js b/bh20simplewebuploader/static/map.js index 8b8ecba..e877454 100644 --- a/bh20simplewebuploader/static/map.js +++ b/bh20simplewebuploader/static/map.js @@ -6,12 +6,11 @@ var map = L.map( 'mapid', { }); L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', + attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | <a href="http://covid19.genenetwork.org/">COVID-19 PubSeq</a>', subdomains: ['a','b','c'] }).addTo(map); -var markers = L.markerClusterGroup().addTo(mapid) - +// var markers = L.markerClusterGroup().addTo(mapid) function drawMap(){ var mymap = map; @@ -22,6 +21,7 @@ function drawMap(){ return response.json(); }) .then(data => { + /* for (var i=0; i<data.length;i++) { gps=data[i]["GPS"].split(" ") var circle = L.circle([gps[1], gps[0]], { @@ -31,7 +31,8 @@ function drawMap(){ radius: parseInt(data[i]["count"]) //not working for whatever reason }).addTo(mymap); } - // updateMapMarkers(data); + */ + updateMapMarkers(data); }); document.getElementById("map_view").classList.remove("invisible"); @@ -44,10 +45,6 @@ function drawMap(){ * */ function updateMapMarkers(data) { - // markers.clearLayers(); // remove all markers - // document.getElementById("results").classList.remove("invisible"); - // document.getElementById("loader").classList.add("invisible"); - for (let i = 0; i < data.length; i++) { let {"count": fastaCount, GPS, LocationLabel: label } = data[i]; let coordinates = GPS.split(" "); @@ -55,14 +52,8 @@ function updateMapMarkers(data) { let lat, lon; [lon, lat] = coordinates.map(parseFloat); let point = L.point() - let marker = L.marker([lat, lon]); - marker.bindPopup("<b>" + label + "</b><br/>" + "FastaCount: " +fastaCount); - // markers.addLayer(marker) + L.marker([lat, lon]).addTo(map) + .bindPopup("<b>" + label + "</b><br/>" + "FastaCount: " +fastaCount); } } - - // Reload the map - // map.invalidateSize(); - // document.getElementById("map_view").classList.add("invisible"); - // document.getElementById("loader").classList.add("invisible"); } |