notfall/notfall.tmpl
kekskurse 123b48bc7c
All checks were successful
continuous-integration/drone/push Build is passing
Stuff
2022-01-16 13:02:33 +01:00

40 lines
No EOL
1.4 KiB
Cheetah

<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<style type="text/css">
#map { height: 80%; }
</style>
</head>
<body>
<div id="map"></div>
Last Update: <span id="update"></span>
<script>
var map = L.map('map').setView([52.5, 13.5], 10);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
circle = L.circle([52.5, 13.5], {radius: 200}).addTo(map);
marker = L.marker([52.5, 13.5]).addTo(map)
function update() {
fetch('/json')
.then(response => response.json())
.then(data => {
map.setView([data["lat"], data["lon"]], 18);
circle.setLatLng([data["lat"], data["lon"]])
marker.setLatLng([data["lat"], data["lon"]])
document.getElementById("update").innerHTML = data["tst"]
circle.setRadius(data["acc"])
});
}
update()
</script>
</body>