diff options
author | stuebinm | 2022-12-05 16:37:27 +0100 |
---|---|---|
committer | stuebinm | 2022-12-05 16:37:27 +0100 |
commit | 8a10ea437cf74619865e0966f8be8f16e6cba938 (patch) | |
tree | 3f6d07986d3eb2963114739ccfab6ad0756fa443 /chaski/ilztal.live/geolocation/mapview.html | |
parent | 64546ed6399d49ff125ee667b9632825eb3ccba5 (diff) |
update to nixos22.11
Diffstat (limited to 'chaski/ilztal.live/geolocation/mapview.html')
-rw-r--r-- | chaski/ilztal.live/geolocation/mapview.html | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/chaski/ilztal.live/geolocation/mapview.html b/chaski/ilztal.live/geolocation/mapview.html deleted file mode 100644 index bb62f62..0000000 --- a/chaski/ilztal.live/geolocation/mapview.html +++ /dev/null @@ -1,94 +0,0 @@ -<!doctype html> -<html class="no-js" lang=""> - <head> - <meta charset="utf-8"> - <meta http-equiv="x-ua-compatible" content="ie=edge"> - <title>Position view</title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <link rel="apple-touch-icon" href="/apple-touch-icon.png"> - <!-- Place favicon.ico in the root directory --> - - <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" - integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" - crossorigin=""/> - <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" - integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" - crossorigin=""></script> - - </head> - <body> - <!--[if lt IE 8]> - <p class="browserupgrade"> - You are using an <strong>outdated</strong> browser. Please - <a href="http://browsehappy.com/">upgrade your browser</a> to improve - your experience. - </p> - <![endif]--> - - <div align="justify"> - <div id="MapID2" style="height:100vh; margin-left: auto; margin-right:auto; width:80%"></div> - </div> - <script> - var mymap = L.map('MapID2'); - L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZmVsaXg4MTgyOTMiLCJhIjoiY2p6a2h6cjdyMGpicjNvbzlzZ3UwNmloMCJ9.a4t1KM9Gid-q29ultM7HgA', { - attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', - maxZoom: 18, - id: 'mapbox/streets-v11', - accessToken: 'pk.eyJ1IjoiZmVsaXg4MTgyOTMiLCJhIjoiY2p6a2h6cjdyMGpicjNvbzlzZ3UwNmloMCJ9.a4t1KM9Gid-q29ultM7HgA' - }).addTo(mymap); - var marker = L.marker([0,0]).addTo(mymap); - marker.bindPopup("Hello Train!"); - - mymap.setView([0,0], 16); - function updateMap(pos) { - if (pos === null) { - console.log("no data yet?"); - return; - } - mymap.setView(pos); - mymap.scrollWheelZoom.disable(); - marker.setLatLng(pos); - } - updateMap([48.13716,11.57540]); - - function fetchUpdate () { - fetch("https://ilztal.live/geoloc/history") - .then((data) => { - let text = data.text().then(text => { - let hist = JSON.parse(text); - console.log(hist) - - let latlngs = hist.filter(e => e.data.latitude !== undefined).map((e) => [e.data.latitude, e.data.longitude]); - - console.log(latlngs); - let polyline = L.polyline(latlngs, {color: "red"}).addTo(mymap); - - mymap.fitBounds(polyline.getBounds()) - - for (idx in hist) { - if (hist[idx].data.latitude === undefined) { - console.log(hist[idx].data, idx, 1+parseInt(idx)) - let nidx = 1+parseInt(idx); - if (hist[nidx] !== undefined && hist[nidx].data.latitude !== undefined) { - let marker = L.marker([hist[nidx].data.latitude, hist[nidx].data.longitude]) - .addTo(mymap); - marker.bindPopup(hist[idx].data); - } - } - } - }); - - }) - .catch((e) => { - console.log("some error!", e); - setTimeout(fetchUpdate, 3000); - }) - } - - fetchUpdate() - </script> - - </body> -</html> |