diff options
Diffstat (limited to 'bh20simplewebuploader/static/main.js')
-rw-r--r-- | bh20simplewebuploader/static/main.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js index 149eb3c..f2e5d99 100644 --- a/bh20simplewebuploader/static/main.js +++ b/bh20simplewebuploader/static/main.js @@ -56,6 +56,7 @@ function fetchAPI(apiEndPoint) { } +// Copy from function above but now added as table instead of plain json function fetchAPIV2(apiEndPoint) { fetch(scriptRoot + apiEndPoint) .then(response => { @@ -115,6 +116,9 @@ let fetchSEQByLocation = () => { console.log("Missing - set parameter for request, retrieve data") }; +let fetchSEQCountbyContinent = () => { + fetchAPIV2("/api/getSEQCountbyContinent"); +} /* @@ -243,3 +247,36 @@ function on_submit_button() { return false; } } + + + +// + +function drawMap(){ + +// 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: '© <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); + } + + }); +}
\ No newline at end of file |