Worldmap Tracks Node

Hi there. Is it possible to pass an array of elements into the worldmap tracks node and have it track properly? Whenever I do it, it just updates the point without adding a track. Am I missing a certain property when creating points?

Which version of the node are you using. I thought this was fixed very recently.. What does your array look like ?

I'm using version 2.3.6. Maybe I'm just inexperienced with Node Red, but I can't seem to make the tracks appear.

This is what's in my array:
image

Never mind, I think I was still using an old version of the tracks node for some reason. I just deleted the node and replaced it and it started working again.

However, I do have another question: is there any way to constantly change old tracks to a different color so that you can clearly tell where the latest track line is? The way I have my flow set up, the array is constantly being pushed into the tracks node every 3 seconds so that the map is automatically refreshed for any connected viewers, and I want to somehow keep the colors consistent whenever I add a new point.

the track node is meant to do the accumulation for you - ie you just send in single points as you go and it will create the tracks and send them to the map. You can send in complete track as you have done but I suspect (without checking the code) that you will just be adding loads of duplicate lines on top of each other... especially if you redo this every 3 seconds.

Also note the worldmap in node can detect client attaching - and this could be used to retrigger sending data to ensure they get latest positions etc.

You can add a lineColor property to set the color of the track - but it will be for tor that whole track not just a segment.

The reason I'm consistently pushing the array in is to ensure that people who have already connected to the map will continue to receive any updates on the map in real time without having to refresh the page.

Here's how I did it:

[{"id":"ff7cb829.cab218","type":"inject","z":"463ea969.55fbc8","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"3","crontab":"","once":true,"onceDelay":"1","x":220,"y":1380,"wires":[["95cca40d.fbfc48","5fea37ef.dfc4b8"]]},{"id":"9c19e44d.3e1dd8","type":"worldmap in","z":"463ea969.55fbc8","name":"","path":"/worldmap","events":"","x":80,"y":1420,"wires":[["d3ea8a6.c932978"]]},{"id":"d3ea8a6.c932978","type":"switch","z":"463ea969.55fbc8","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":210,"y":1420,"wires":[["95cca40d.fbfc48"]]},{"id":"95cca40d.fbfc48","type":"function","z":"463ea969.55fbc8","name":"Array Update","func":"msg.payload = global.get(\"array\");\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":1420,"wires":[["45737536.60a7fc","eb190cf4.90f84","e89fb5f0.b32b18","d5b79879.e6fb08"]]},{"id":"eb190cf4.90f84","type":"worldmap-tracks","z":"463ea969.55fbc8","name":"","depth":"3","layer":"combined","x":490,"y":1480,"wires":[["45737536.60a7fc","d5b79879.e6fb08"]]},{"id":"45737536.60a7fc","type":"worldmap","z":"463ea969.55fbc8","name":"","lat":"37.748658","lon":"-121.446979","zoom":"17","layer":"Esri Satellite","cluster":"","maxage":"0","usermenu":"hide","layers":"hide","panit":"true","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","showgrid":"true","path":"","x":610,"y":1420,"wires":[]}]

Is there a more efficient way of enforcing real-time updates for connected users? Also, would it be possible to run through each element of the array in a loop and add the lineColor property to each point before adding a new point?

You don’t have to do that. If a point updates ( is resent to the map ) it automatically adds to the track no need to send the track.

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