Worldmap GPS tracking

Hi All
I have a requirement to add tracks to GPS data on a map
I'm guessing/assuming that the tracks node will give these functionality

image

Only problem is, I'm not sure how to use it

Is it stand alone?
does it feed into the Worldmap node?

what data do I feed it?

I already have data fed into a database, and historical points plotted on the map, just need to track them now

does anyone have an example I could have a look at

Where did you get the tracks node from it isn’t one of the preinstalled ones. What is it’s full name?

I'm assuming it came with worldmaps
image

It is one of the nodes that Worldmap provides.

It's help text is pretty lacking in any detail on what to pass it and how to use it - the only example it gives is how to delete a track, nothing on how to create a track.

I can't see it used in any of the examples the Worldmap node provides either.

May need some pointers from @dceejay

It seems to be working.
Just simply feed the GPS points

First data point it just stores - well seems to
Second data point is also stored, we get a 2 point array
Line on map drawn between these two points

image

image

over time the array is growing, as expected and predicted.

Could that be managed?
say a configurable number of points to hold, and when full, new data points push the eldest of the end?
Thanks for the quick responses gents

What options does the node have ?

Assuming you mean this
image

so points to hold is already configurable... I'll get me coat

1 Like

I actually ran into the same problem last night, and looking through the closed issues on github as well as the source code for it gave me the answer. For the tracks node to work with markers, you have to feed the marker object with location into both the tracks node and the worldmap directly, and have the tracks node output in the worldmap as well. If you don't output directly into the worldmap, it will show the tracks as-track, but the marker to go with it (for example icon, label and so on) are missing. As the docs for the node show, the "number of points in track" from the configuration can also be added as a property to the marker object, but it took some careful reading to understand that from the docs:

The number of tracked points can be set per marker by specifying msg.payload.trackpoints as part of the update for a marker.

Below is the flow I put together using this (but without the msg.payload.trackpoints usage, working pretty good for just a test setup :slight_smile:

[{"id":"1e2ad62e.e63ada","type":"tab","label":"Pytrack GPS","disabled":false,"info":""},{"id":"3e95a316.38dd74","type":"mqtt in","z":"1e2ad62e.e63ada","name":"Pytrack","topic":"pytrack/#","qos":"2","datatype":"auto","broker":"9646c685.9f4cc","x":78.5,"y":85,"wires":[["4c947b88.56252c"]]},{"id":"654d0e6d.16e858","type":"ui_chart","z":"1e2ad62e.e63ada","name":"","group":"7fb3bc7c.4119e4","order":1,"width":6,"height":6,"label":"Roll","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":346.5,"y":59,"wires":[[]]},{"id":"d10f9cc7.870778","type":"ui_chart","z":"1e2ad62e.e63ada","name":"","group":"7fb3bc7c.4119e4","order":2,"width":6,"height":6,"label":"Pitch","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":345.5,"y":100,"wires":[[]]},{"id":"b1d5fa81.5113d","type":"worldmap-tracks","z":"1e2ad62e.e63ada","name":"","depth":"600","layer":"combined","x":449.5,"y":407,"wires":[["48a1619a.9e5b98","66afeed5.551ef8"]]},{"id":"66afeed5.551ef8","type":"worldmap","z":"1e2ad62e.e63ada","name":"Pytrack map","lat":"51","lon":"6","zoom":"17","layer":"OSM","cluster":"","maxage":"3600","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/worldmap","x":638.5,"y":407,"wires":[]},{"id":"4c947b88.56252c","type":"switch","z":"1e2ad62e.e63ada","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"pytrack/roll","vt":"str"},{"t":"eq","v":"pytrack/pitch","vt":"str"},{"t":"eq","v":"pytrack/gps","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":216.5,"y":86,"wires":[["654d0e6d.16e858"],["d10f9cc7.870778"],["f22b5d4e.ab109"]]},{"id":"2387edd0.937cca","type":"debug","z":"1e2ad62e.e63ada","name":"GPS coords","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":519.5,"y":154,"wires":[]},{"id":"f22b5d4e.ab109","type":"json","z":"1e2ad62e.e63ada","name":"","property":"payload","action":"","pretty":false,"x":351.5,"y":154,"wires":[["2387edd0.937cca","be36670.0461a98"]]},{"id":"87953383.276128","type":"function","z":"1e2ad62e.e63ada","name":"Add marker properties","func":"msg.payload.name = 'Lena';\nmsg.payload.icon = ':wheelchair:';\nmsg.payload.tooltip = msg.payload.name;\nmsg.payload.layer = \"GPS\";\nreturn msg;","outputs":1,"noerr":0,"x":533.5,"y":295,"wires":[["729ea056.a2ada8","66afeed5.551ef8","b1d5fa81.5113d"]]},{"id":"48a1619a.9e5b98","type":"debug","z":"1e2ad62e.e63ada","name":"Tracks","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":580.5,"y":507,"wires":[]},{"id":"729ea056.a2ada8","type":"debug","z":"1e2ad62e.e63ada","name":"Coords with name","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":780.5,"y":296,"wires":[]},{"id":"be36670.0461a98","type":"rbe","z":"1e2ad62e.e63ada","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":350.5,"y":207,"wires":[["fc71eb07.6397c8"]]},{"id":"fc71eb07.6397c8","type":"switch","z":"1e2ad62e.e63ada","name":"when not null","property":"payload.lat","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":299.5,"y":279,"wires":[["87953383.276128"]]},{"id":"1de2745d.e5b16c","type":"inject","z":"1e2ad62e.e63ada","name":"Delete track","topic":"","payload":"{\"name\":\"Lena\",\"deleted\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":248.5,"y":406,"wires":[["b1d5fa81.5113d"]]},{"id":"40294458.1a517c","type":"ui_template","z":"1e2ad62e.e63ada","group":"7fb3bc7c.4119e4","name":"","order":3,"width":12,"height":6,"format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":821.5,"y":59,"wires":[[]]},{"id":"16ebabe5.a593e4","type":"template","z":"1e2ad62e.e63ada","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=\"300px\"></iframe>","output":"str","x":675.5,"y":59,"wires":[["40294458.1a517c"]]},{"id":"97c9762c.47976","type":"inject","z":"1e2ad62e.e63ada","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":523.5,"y":59,"wires":[["16ebabe5.a593e4"]]},{"id":"9646c685.9f4cc","type":"mqtt-broker","z":"","name":"local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"7fb3bc7c.4119e4","type":"ui_group","z":"","name":"GPS","tab":"3ca0c34b.d48204","disp":true,"width":12,"collapse":false},{"id":"3ca0c34b.d48204","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

(in case you wonder what it does, I mounted a GPS tracker underneath my wheelchair and I'm attempting to read it out and display it on the map)

Usage for the tracks node can be found in the example "Map in Dashboard", but it takes scrolling through old issues to find that (or testing them one by one).

One thing I seem to be seeing.
I have points in track = 20

When I get multiple tracks on the map, and looking like 20 points, the tracks are all removed and the tracks start again, so rather than losing the oldest track, we lose all track history at given points in time.
I would have thought keeping the (visual) history would have been better

Also every so often tracks aren't drawn in
image
See the blue trace.

The above aside, that was deceptively easy to configure and get something running.

Missing traces look like it could be a duplicate of points issue.
My devices aren't moving, and the red and blue are indoors on a window ledge, so the traces are just from the 'inaccuracy' of the satellite data.
So not inconceivable that points get duplicated, within a short space of time

If you are able, can you raise an issue against that node on github please. Preferably with details how to recreate the issue. Thanks.

@ChrisO - If you can find the file node_modules/node-red-contrib-web-worldmap/worldmap/worldmap.js - change line 1014 to

if (markers[data.name].lay !== lay) { 

Stop and restart Node-RED and reload the map page a couple of times to flush the cache. Hopefully that is better.

@dceejay
Done
I'll keep you posted

You still need me raise the issue on github?

Depends if it fixes it or not ....

@dceejay
Missing traces seems to be covered


easier to see on red Trace
At least one duplicate point on green trace too

then the green trace does this
image .
18 points, if I've counted correctly - that 'floating' wasn't the start point, but the penultimate point.

And then all points are lost, from the green trace
image

so yes - you may need to raise an issue - if it is possible to share some of the data you are using to re-create that would be helpful

Here's a link to a project I posted on Discourse to track a mobile phone (when I went cycling).

http://resources-area.co.uk/node-red-flows/tracking_a_mobile_device.pdf

By-the-way, the location shown on your map is just down the road from my daughter's house in Basingstoke on the new Belway estate!!!
What a small world.

Issue raised #120.
Track data attached

Raised in the wrong place, sorry.

Now here

And from last summer's treat, the Bombay Sapphire Distillery?