aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/static
diff options
context:
space:
mode:
authorPjotr Prins2020-07-17 09:45:58 +0100
committerPjotr Prins2020-07-17 09:45:58 +0100
commit7565f72b1bf0d70426947a50d1b9a62edc48071d (patch)
treefbc36c76a32deb71f7f79cab093a6628f83fae26 /bh20simplewebuploader/static
parentd3fa51ee16d902fc0bfa414611d5e0bae6618009 (diff)
downloadbh20-seq-resource-7565f72b1bf0d70426947a50d1b9a62edc48071d.tar.gz
bh20-seq-resource-7565f72b1bf0d70426947a50d1b9a62edc48071d.tar.lz
bh20-seq-resource-7565f72b1bf0d70426947a50d1b9a62edc48071d.zip
Map is back
Diffstat (limited to 'bh20simplewebuploader/static')
-rw-r--r--bh20simplewebuploader/static/main.css2
-rw-r--r--bh20simplewebuploader/static/map.js71
2 files changed, 36 insertions, 37 deletions
diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css
index b28ee9c..9f89045 100644
--- a/bh20simplewebuploader/static/main.css
+++ b/bh20simplewebuploader/static/main.css
@@ -47,7 +47,7 @@ h2 > svg {
float: right;
}
-#map {
+#mapid {
width: 800px;
height: 440px;
border: 1px solid #AAA;
diff --git a/bh20simplewebuploader/static/map.js b/bh20simplewebuploader/static/map.js
index afc6c3f..e1a4289 100644
--- a/bh20simplewebuploader/static/map.js
+++ b/bh20simplewebuploader/static/map.js
@@ -1,43 +1,40 @@
-let map = L.map( 'map', {
- center: [37.0902, -95.7129], // Default to U.S.A
- minZoom: 3,
- zoom: 0
+
+var map = L.map( 'mapid', {
+ center: [51.505, -0.09], // Default to U.S.A
+ minZoom: 2,
+ zoom: 0
});
+
L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
- subdomains: ['a','b','c']
-}).addTo( map );
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
+ subdomains: ['a','b','c']
+}).addTo(map);
-let markers = L.markerClusterGroup().addTo(map)
+var markers = L.markerClusterGroup().addTo(mapid)
function drawMap(){
+ var mymap = map;
-// initialize the map on the "map" div with a given center and zoom
-var mymap = L.map('mapid').setView([51.505, -0.09], 1);
-
-L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
-}).addTo(mymap);
-
-fetch(scriptRoot + "api/getCountByGPS")
- .then(response => {
- console.log(response)
- 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]], {
- color: 'red',
- fillColor: '#f03',
- fillOpacity: 0.5,
- radius: parseInt(data[i]["count"]) //not working for whatever reason
- }).addTo(mymap);
- }
+ fetch(scriptRoot + "api/getCountByGPS")
+ .then(response => {
+ console.log(response)
+ 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]], {
+ color: 'red',
+ fillColor: '#f03',
+ fillOpacity: 0.5,
+ radius: parseInt(data[i]["count"]) //not working for whatever reason
+ }).addTo(mymap);
+ }
});
+ document.getElementById("map_view").classList.remove("invisible");
+ map.invalidateSize();
}
@@ -46,9 +43,10 @@ fetch(scriptRoot + "api/getCountByGPS")
*
*/
function updateMapMarkers() {
- markers.clearLayers(); // remove all markers
- document.getElementById("results").classList.remove("invisible");
+ // 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(" ");
@@ -58,10 +56,11 @@ function updateMapMarkers() {
let point = L.point()
let marker = L.marker([lat, lon]);
marker.bindPopup("<b>" + label + "</b><br/>" + "FastaCount: " +fastaCount);
- markers.addLayer(marker)
+ // markers.addLayer(marker)
}}
+ */
// Reload the map
map.invalidateSize();
- document.getElementById("map_view").classList.add("invisible");
- document.getElementById("loader").classList.add("invisible");
+ // document.getElementById("map_view").classList.add("invisible");
+ // document.getElementById("loader").classList.add("invisible");
}