Remove Marker from Worldmap

i am receiving an array of points with lat and lon locations from a database, and i am able to plot them on the worldmap, my problem is the following:
1- my query perform an update using a time interval (every 3 Sec), and every time my query runs an update it receive a different array of points, as some new points are added and some points are no longer valid and are required to be deleted/removed from the worldmap.
2- the map adds the new points with no problem however it does not deleted/remove the invalid ones on its own.
3- i tried the solution to clear the layer that contains the markers by using (msg.payload.command.clear = name of the layer) before i update the map with the updated result of my query, however this has resulted an annoying blink on the map before each update.
4- i tried to use the "differences" node to add the new points and delete the invalid one, however i have encountered another issue, the "deleted" function that i found on the node page does not perform anything and hence i am not able to delete the points that i need to remove from the map.
5- the TTL function is not an option for me as it uses a time and i need something near real time and without a blink.

is there is any way where i can perform an update on the map that will add the valid points (the result of my query) and delete the ones that are invalid (not in the result of my query) without having this annoying blink that is the result of the msg.payload.command.clear function??

sorry for the long problem description and thanks in advance.

Unless someone knows the answer off-hand, your best bet is to post the simplest flow that reproduces the problem. E.g. inject some sample data and perform the operation you'd like and explain how it's not doing the right thing. Then we can look and figure out how to fix it.

4 should certainly work so yes as @tve suggests if you can supply a small example we can take a look,.

i will try to provide you with a simple flow as an example of what i am facing

however can someone confirm that the deleted command actually works?
the command that i am using is the following (it not actually deleting the marker):

msg.payload.command.deleted= (where name is the name of the marker used by worldmap)

Reading the docs and does not say anywhere that the deleted should be property of command.

So if you have named marker you just add the deleted property to the object in msg.payload.

msg.payload = { "name":"Jason", "lat":51.05, "lon":-1.35, "deleted":true}

Yeah but recent bug... deleted: true stopped working · Issue #222 · dceejay/RedMap · GitHub
:slight_smile: fixing now...

pushed as v2.33.0

1 Like

sorry my bad, you are correct, however i tried the correct syntax and that did not work either.

i guess i will have to wait for dceejay to fix it.

thanks dceejay for the quick fix, the deleted function now works like a charm.

i will perform the flow using case 4 in my original post and update you on the findings

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