# Worldmap GPS tracking

**URL:** <https://discourse.nodered.org/t/worldmap-gps-tracking/13895>\
**Category:** Dashboard\
**Created:** [1 August 2019 09:15 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895 "2019-08-01T09:15:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [1 August 2019 09:15 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/1 "2019-08-01T09:15:33Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/74143167a3eb5ad84089e71ccb14cf2cf51d727e.png)

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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [1 August 2019 09:40 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/2 "2019-08-01T09:40:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [1 August 2019 09:43 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/3 "2019-08-01T09:43:20Z")

</div>

I'm assuming it came with worldmaps  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/ce0e14501bca249e8c4498736da7dfd55a73ece3.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 August 2019 09:44 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/4 "2019-08-01T09:44:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [1 August 2019 09:51 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/5 "2019-08-01T09:51:24Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/946ce4bc3b3d621067f8a7cc13b2845f429df125.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/56a5c40215c7963d4f039895f6094edf5b774838.png)

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 August 2019 09:52 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/6 "2019-08-01T09:52:50Z")

</div>

What options does the node have ?

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [1 August 2019 10:24 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/7 "2019-08-01T10:24:33Z")

</div>

Assuming you mean this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/08ebfed9e00b38205cf0d5fc558788d3bdb49346.png)

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

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [1 August 2019 12:05 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/8 "2019-08-01T12:05:18Z")

</div>

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 🙂

```auto
[{"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](https://github.com/dceejay/RedMap/blob/master/examples/Map%20in%20Dashboard.json)", but it takes scrolling through old issues to find that (or testing them one by one).

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [1 August 2019 14:05 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/9 "2019-08-01T14:05:24Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f0053717e22400f7be6ee22b37fe7361d5016be8.png)  
See the blue trace.

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

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [1 August 2019 14:25 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/10 "2019-08-01T14:25:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 August 2019 14:48 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/11 "2019-08-01T14:48:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 August 2019 21:19 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/12 "2019-08-01T21:19:01Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [2 August 2019 07:45 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/13 "2019-08-02T07:45:24Z")

</div>

@dceejay  
Done  
I'll keep you posted

You still need me raise the issue on github?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 August 2019 07:48 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/14 "2019-08-02T07:48:17Z")

</div>

Depends if it fixes it or not ....

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [2 August 2019 09:17 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/15 "2019-08-02T09:17:30Z")

</div>

@dceejay  
Missing traces seems to be covered

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f3fbcd2988dba4d96ad6440d9db23a9f05b9f089.jpeg)  
easier to see on red Trace  
At least one duplicate point on green trace too

then the green trace does this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b2c9db63d2709f8abc13b235a83cae66833c7e1a.png) .  
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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2765a3d2e6ffe5dc33c91b8c0677d1157eb4a130.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [3 August 2019 19:00 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/16 "2019-08-03T19:00:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [3 August 2019 19:07 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/17 "2019-08-03T19:07:48Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [6 August 2019 07:55 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/18 "2019-08-06T07:55:22Z")

</div>

Issue raised #120.  
Track data attached

---

<div class="post-metadata">

**Author:** ![ChrisO](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@ChrisO](https://discourse.nodered.org/u/ChrisO)\
**Post date:** [6 August 2019 08:19 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/19 "2019-08-06T08:19:20Z")

</div>

Raised in the wrong place, sorry.

Now here

> <https://github.com/dceejay/RedMap/issues/110>

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [15 August 2019 01:49 UTC](https://discourse.nodered.org/t/worldmap-gps-tracking/13895/20 "2019-08-15T01:49:00Z")

</div>

> [@dynamicdave](#):
>
> just down the road from my daughter's house

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

[Next page](https://discourse.nodered.org/t/worldmap-gps-tracking/13895.md?page=2)
