From a2c2342000aea4efa5140afa89e4ed66dd466100 Mon Sep 17 00:00:00 2001
From: lltommy
Date: Tue, 16 Jun 2020 12:43:08 +0200
Subject: starting to include a map
---
bh20simplewebuploader/static/main.js | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
(limited to 'bh20simplewebuploader/static')
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js
index 1d2bcba..efefe70 100644
--- a/bh20simplewebuploader/static/main.js
+++ b/bh20simplewebuploader/static/main.js
@@ -28,6 +28,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 => {
@@ -218,3 +219,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: '© OpenStreetMap contributors'
+}).addTo(mymap);
+
+fetch(scriptRoot + "api/getCountByGPS")
+ .then(response => {
+ console.log(response)
+ return response.json();
+ })
+ .then(data => {
+
+ for (var i=0; i