This commit is contained in:
parent
8f6ed84ee0
commit
775e65ad68
2 changed files with 5 additions and 0 deletions
1
main.go
1
main.go
|
@ -44,6 +44,7 @@ func main() {
|
|||
data["lat"] = lastData["lat"]
|
||||
data["lon"] = lastData["lon"]
|
||||
data["tst"] = lastData["tst"]
|
||||
data["acc"] = lastData["acc"]
|
||||
|
||||
r, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
|
|
|
@ -20,11 +20,15 @@
|
|||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(map);
|
||||
|
||||
circle = L.circle([50.5, 30.5], {radius: 200}).addTo(map);
|
||||
|
||||
function update() {
|
||||
fetch('/json')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
map.setView([data["lat"], data["lon"]], 13);
|
||||
circle.setLatLng([data["lat"], data["lon"]])
|
||||
circle.setRadius(data["acc"])
|
||||
});
|
||||
}
|
||||
update()
|
||||
|
|
Loading…
Reference in a new issue