mirror of
https://github.com/owntracks/recorder.git
synced 2024-11-15 09:58:40 -07:00
Merge pull request #246 from edautz/master
Added speed information to Openstreet map point
This commit is contained in:
commit
59c18af596
@ -42,12 +42,23 @@ function initialize_leaflet() {
|
||||
data.lon = feature.geometry.coordinates[1].toFixed(4);
|
||||
data.addr = feature.properties.address;
|
||||
var tst = feature.properties.tst;
|
||||
// determine speed
|
||||
data.speed = feature.properties.vel;
|
||||
var speed = data.speed;
|
||||
var dt = moment.utc(tst * 1000).local();
|
||||
data.tst = tst;
|
||||
data.fulldate = dt.format("DD MMM YYYY HH:mm:ss")
|
||||
var t = "{{ addr }}<br/><span class='latlon'>({{ lat }},{{lon}})</span> {{ fulldate }}";
|
||||
var t = "{{ addr }}<br/><span class='latlon'>({{ lat }},{{lon}})</span> {{ fulldate }}<br/> Speed: {{ speed }}";
|
||||
// if speed is 0 then don't display speed
|
||||
if (speed === 0) {
|
||||
t = "{{ addr }}<br/><span class='latlon'>({{ lat }},{{lon}})</span> {{ fulldate }}"
|
||||
}
|
||||
if (typeof(tst) === 'undefined') {
|
||||
t = "Position: {{lat}}, {{lon}}";
|
||||
t = "Position: ({{lat}},{{lon}})<br/>Speed: {{speed}}";
|
||||
}
|
||||
// if speed is 0 then don't display speed
|
||||
if (typeof(tst) === 'undefined' && speed === 0) {
|
||||
t = "Position: ({{lat}},{{lon}})";
|
||||
}
|
||||
|
||||
layer.bindPopup(Mustache.render(t, data));
|
||||
|
Loading…
Reference in New Issue
Block a user