Worldmap tracks shows old value

I am using node-red worldmap track node to do the tracking of my drone flight. I am having following issue with it.

First issue is that it shows me old flight tracks, and the 2nd issue is that it draw one straight track line between two markers on its own.

How can i reset track on map? With the code below i can reset my other layers but track layer remember old flight tracks points until i reload node-red.

if (msg.payload === 'reset') {
    var layersToRemove = ['destinations', 'uav', 'Homeposition', 'waypoints','tracks',"tracks_"];
    var removalCommands = [];

    layersToRemove.forEach(function(layerName) {
        var removalCommand = {
            command: {
                clear: layerName
            }
        };

        removalCommands.push(removalCommand);
    });

    // Sending removal commands for each layer
    removalCommands.forEach(function(command) {
        var msgToRemoveLayer = { payload: command };
        node.send(msgToRemoveLayer);
    });
}


you have tracks_ shown on the map and then your code deletes Tracks_ with a capital T... try with t.

yes i noticed the issue and did the same but i still have the same issue. One other wired thing is that I publish tracks as tracks layer in map but they are displayed as tracks_

var track = {
                    'name': 'tracks',
                    'lat': parseFloat(currentData._value),
                    'lon': parseFloat(longitudeData._value),
                    //'icon': 'uav',
                   // 'iconColor': 'blue',
                    'layer': 'tracks',
                    //'popped': false
                };
  1. what version of NR and node.js are you running? (see the NR startup log to get this info)
  2. what platform are you running NR on?
  3. Please export your flow and attach it to a reply

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Not sure how important this is in the syntax - you have a comma after the last entry.

Corrected.

var track = {
                    'name': 'tracks',
                    'lat': parseFloat(currentData._value),
                    'lon': parseFloat(longitudeData._value),
                    //'icon': 'uav',
                   // 'iconColor': 'blue',
                    'layer': 'tracks'
                    //'popped': false
                };

It is not a problem for an objects last property to have a trailing comma (and some folk prefer it).

2 Likes

Yes, I prefer it, as when you do a git diff between the versions after adding a line it only shows the inserted line and not the one before with the added comma.
I think that with JSON strings, however, the commas are not allowed.

1 Like

Yep, trailing commas are not permitted in JSON (but JSON.stringify will happily remove dangling commas from a JS object for you)

Your delete code still references Tracks

Node.js version: v20.9.0, Node-RED version: v3.1.0
I am runnig in on Windows 10 ISO 64 Bit
Here is my flow
past flight.json (49.6 KB)

Though the above code when i remove the layers, it worked fine. All the layers are removed from map. But when i run the simulation flight agian, it shows tracks of previous flight too.

If i restart the node-red and then run the simulation flight then everything works perfectly fine.

My guess is that node-red wroldmap tracks are stored in some variable if we can reset it before every flight, the issue should be resolved.

1 Like

Here i can visually explain the issue.

If i load the data of flight 1 from the database its displayed like that

Then if i restart node-red and and load the data of flight 2 from the database its displayed like that

If i don't restart node-red and delete layer on map, the layers are removed temperoraly but when i fetch data of any flight, the tracks of both fligths are displayed like that

I am facing the same issue for quiet long with real time tracking of drone too in node-red.

I notice that this world map nodes has Remove markers after set to 3100 which is a little over a half hour.

What happens if you use a shorter time there?

Still facing the same issue, i set the time to 1s but still facing the same issue.

Please add a write-file' to the output of each of the influx-innodes and give the data files the name of theinflux-in` node. Then attach those files to a reply.

This will allow myself (or someone else) to use file-in nodes in place of the influx-in nodes and we could test your flow to see if we can recreate the issue.

Here are the files

dest.log (1.8 KB)
home.log (1.8 KB)
tracks.log (206.5 KB)
waypoint.log (644 Bytes)

There is no file for the 'All Topics' influx-in node.

Sorry i didn't understand what you are trying to say, can you explain me a bit more. And thanks for helping me in resolving the issue

past flight.json (51.4 KB)

Here is my flow in which i have added write files node and the data of influxdb is written to the respectives files

Let me explain. Since I don't have your influx database, your flows will not run for me. Since the flow is grabbing data from the influxdb, by capturing that data and storing it in files, I can remove the `influx-in' nodes and replace them with 'file-in' nodes to read the data you provide.

You provided 4 files but you have 5 influx-in nodes. The data from this influx-in was not provided so the flow doesn't work since it needs that data.

I hope that clears things up

1 Like

Thanks for the explaination, i thought i only have 4 influx in nodes. Here are the files

Alltopics.log (91.1 KB)
dest.log (1.2 KB)
home.log (1.2 KB)
tracks.log (119.1 KB)
waypoint.log (640 Bytes)