Track Node in Worldmap

Need support in using the node red tracker node for the Worldmap.i am unable to see lines on my map as i don't know why it is not working?pls help
i also referred the documentation but many things are missing in it.


Here is the flow file for ur refrenceflows (1).json (12.9 KB)

I just played with it yesterday. Here's my flow, do you see tracks with it?

[{"id":"1a01c684.02a219","type":"worldmap","z":"2cc2b60c.fb70ba","name":"","lat":"58.372","lon":"26.682","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/worldmap","x":900,"y":360,"wires":[]},{"id":"edeac50f.2f5528","type":"inject","z":"2cc2b60c.fb70ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"0.5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":360,"wires":[["d00d3bb7.db9058"]]},{"id":"ad4e43d2.068e2","type":"change","z":"2cc2b60c.fb70ba","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.name","pt":"msg","to":"last.name","tot":"flow"},{"t":"set","p":"payload.layer","pt":"msg","to":"markers","tot":"str"},{"t":"set","p":"payload.lat","pt":"msg","to":"last.lat","tot":"flow"},{"t":"set","p":"payload.lon","pt":"msg","to":"last.lon","tot":"flow"},{"t":"set","p":"payload.icon","pt":"msg","to":"fa-male","tot":"str"},{"t":"set","p":"payload.iconColor","pt":"msg","to":"last.color","tot":"flow"},{"t":"set","p":"payload.color","pt":"msg","to":"last.color","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":360,"wires":[["eee076e7.1847b8","1a01c684.02a219"]]},{"id":"d00d3bb7.db9058","type":"function","z":"2cc2b60c.fb70ba","name":"","func":"var last = flow.get('last') || {}\nif(!last || !last.lon){\n    last = {\n        lat:58.372,\n        lon:26.683,\n        name:'fire_0'\n    }\n}\nvar r1 = Math.random() > .7 ? 1 : -1\nvar r2 = Math.random() > .6 ? 1 : -1\nvar r = Math.floor(Math.random() * 6)\n\nvar colors = ['red','blue','green','gray','orange','yellow']\n\n\nlast.lat = last.lat + Math.random() * 0.0001 * r1\nlast.lon = last.lon + Math.random() * 0.0001 * r2\nlast.name = 'fire_'+r\nlast.color = colors[r]\nflow.set(\"last\",last)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":360,"wires":[["ad4e43d2.068e2"]]},{"id":"eee076e7.1847b8","type":"worldmap-tracks","z":"2cc2b60c.fb70ba","name":"Tracks","depth":"5","layer":"single","x":750,"y":420,"wires":[["1a01c684.02a219"]]}]
1 Like

Thanks @hotNipi yes it works perfectly could u explain the flow?how this track node works and what properties we should pass along with name,lat and lon etc

The function node generates coordinates. Each next is a little bit away from previous. And chooses random number to place only one marker at each iteration. And then stores it into flow context. Placing marker with same name erases previous one so it looks like marker is moved.
Then the change node sets the properties for message in the format that the worldmap needs. The tracks node gets same message and does the tracks based on same message.

Place the debug node after the change node to see the format of messages

A you saying that you don't see the tracks?
This is what I see.

yes @hotNipi it is wroking correctly



@hotNipi all 7 properties that shown in debug window ,are they necessary for showing on track node?And How can we store their tracking history into some database and then show it on a table?

1 Like

In your original example the position was not moving so there was no line to draw.

1 Like

right point :thinking: @dceejay,i forgot to consider it as a situation.

To make this example complete, lets move map also to focus on moving markers.

[{"id":"1a01c684.02a219","type":"worldmap","z":"2cc2b60c.fb70ba","name":"","lat":"58.372","lon":"26.682","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/worldmap","x":1120,"y":360,"wires":[]},{"id":"edeac50f.2f5528","type":"inject","z":"2cc2b60c.fb70ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"0.5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":360,"wires":[["d00d3bb7.db9058"]]},{"id":"ad4e43d2.068e2","type":"change","z":"2cc2b60c.fb70ba","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.name","pt":"msg","to":"last.name","tot":"flow"},{"t":"set","p":"payload.layer","pt":"msg","to":"markers","tot":"str"},{"t":"set","p":"payload.lat","pt":"msg","to":"last.lat","tot":"flow"},{"t":"set","p":"payload.lon","pt":"msg","to":"last.lon","tot":"flow"},{"t":"set","p":"payload.icon","pt":"msg","to":"fa-male","tot":"str"},{"t":"set","p":"payload.iconColor","pt":"msg","to":"last.color","tot":"flow"},{"t":"set","p":"payload.color","pt":"msg","to":"last.color","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":360,"wires":[["eee076e7.1847b8","1a01c684.02a219","ee70212b.bf892"]]},{"id":"d00d3bb7.db9058","type":"function","z":"2cc2b60c.fb70ba","name":"","func":"var last = flow.get('last') || {}\nif(!last || !last.lon){\n    last = {\n        lat:58.372,\n        lon:26.683,\n        name:'fire_0'\n    }\n}\nvar r1 = Math.random() > .7 ? 1 : -1\nvar r2 = Math.random() > .6 ? 1 : -1\nvar r = Math.floor(Math.random() * 6)\n\nvar colors = ['red','blue','green','gray','orange','yellow']\n\n\nlast.lat = last.lat + Math.random() * 0.0001 * r1\nlast.lon = last.lon + Math.random() * 0.0001 * r2\nlast.name = 'fire_'+r\nlast.color = colors[r]\nflow.set(\"last\",last)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":360,"wires":[["ad4e43d2.068e2"]]},{"id":"eee076e7.1847b8","type":"worldmap-tracks","z":"2cc2b60c.fb70ba","name":"Tracks","depth":"5","layer":"single","x":850,"y":400,"wires":[["1a01c684.02a219"]]},{"id":"425d00ae.2a87","type":"change","z":"2cc2b60c.fb70ba","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.command","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.command.lat","pt":"msg","to":"last.lat","tot":"flow"},{"t":"set","p":"payload.command.lon","pt":"msg","to":"last.lon","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":320,"wires":[["1a01c684.02a219"]]},{"id":"ee70212b.bf892","type":"delay","z":"2cc2b60c.fb70ba","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":760,"y":320,"wires":[["425d00ae.2a87"]]}]

@hotNipi i tried ur flow above but it is not injecting anything in debug side bar.

No. To show marker, it takes only name, lat and lon. The other ones takes care of coloring and marker shape.

That is rather question of storing the data. Many ways to do it. Some database, or store in context or write to file. Nothing related to map.

could u show for the current example to store data in some database then displaying it on a table?

I don't have any database node installed.

Thanks @hotNipi i will do this on my own

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.