From 871ec36094a7fa361798f97c2b8d26b7a4882d87 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sun, 4 Oct 2020 10:54:02 +0200 Subject: [PATCH] Leflet GeoJSON map point popups now contain accuracy if available closes #352 --- docroot/map/map_leaflet.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docroot/map/map_leaflet.js b/docroot/map/map_leaflet.js index 5cc7ced..f4aea70 100644 --- a/docroot/map/map_leaflet.js +++ b/docroot/map/map_leaflet.js @@ -43,13 +43,16 @@ function initialize_leaflet() { data.lat = feature.geometry.coordinates[1].toFixed(5); data.lon = feature.geometry.coordinates[0].toFixed(5); data.vel = feature.properties.vel; + data.acc = feature.properties.acc; data.tst = feature.properties.tst; var localtime = moment.utc(data.tst * 1000).local(); data.timestring = localtime.format('YYYY-MM-DD, ddd, HH:mm:ss Z'); var text = []; + data.accstring = ""; if(data.timestring) {text.push('{{ timestring }}')} - if(data.lat && data.lon) {text.push('{{ lat }},{{ lon }}')} + if(data.acc !== undefined) {data.accstring="acc: " + data.acc}; + if(data.lat && data.lon) {text.push('{{ lat }},{{ lon }} {{ accstring }}')} if(data.address) {text.push('{{ address }}')} if(data.vel !== undefined) {text.push('{{ vel }} km/h')} layer.bindPopup(Mustache.render(text.join('
'), data));