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["lat"] = lastData["lat"]
|
||||||
data["lon"] = lastData["lon"]
|
data["lon"] = lastData["lon"]
|
||||||
data["tst"] = lastData["tst"]
|
data["tst"] = lastData["tst"]
|
||||||
|
data["acc"] = lastData["acc"]
|
||||||
|
|
||||||
r, err := json.Marshal(data)
|
r, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -20,11 +20,15 @@
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
|
circle = L.circle([50.5, 30.5], {radius: 200}).addTo(map);
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
fetch('/json')
|
fetch('/json')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
map.setView([data["lat"], data["lon"]], 13);
|
map.setView([data["lat"], data["lon"]], 13);
|
||||||
|
circle.setLatLng([data["lat"], data["lon"]])
|
||||||
|
circle.setRadius(data["acc"])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
update()
|
update()
|
||||||
|
|
Loading…
Reference in a new issue