summaryrefslogtreecommitdiff
path: root/chaski/ilztal.live/geolocation/view.html
diff options
context:
space:
mode:
authorstuebinm2022-01-18 09:43:24 +0100
committerstuebinm2022-01-20 13:19:44 +0100
commit0bcabe1c4b1dd74af233674dfa6c6ec3011ce2c0 (patch)
tree5c58943f99245ff7f745f50b46c34ae288c3e503 /chaski/ilztal.live/geolocation/view.html
parentdb83a406bc6e63289e47ff5d2228c08430832655 (diff)
restructuring directories
Diffstat (limited to 'chaski/ilztal.live/geolocation/view.html')
-rw-r--r--chaski/ilztal.live/geolocation/view.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/chaski/ilztal.live/geolocation/view.html b/chaski/ilztal.live/geolocation/view.html
new file mode 100644
index 0000000..58b4c76
--- /dev/null
+++ b/chaski/ilztal.live/geolocation/view.html
@@ -0,0 +1,77 @@
+<!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:60vh; 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 &copy; <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/current")
+ .then((data) => {
+ let text = data.text().then(text => {
+ let pos = JSON.parse(text);
+ console.log(pos)
+ updateMap(pos.pos);
+ });
+
+ setTimeout(fetchUpdate, 3000);
+ })
+ .catch((e) => {
+ console.log("some error!", e);
+ setTimeout(fetchUpdate, 3000);
+ })
+ }
+
+ fetchUpdate()
+ </script>
+
+ </body>
+</html>