What is the logic for adding and deleting points on the map? I see "deleted":true but how do you keep track of the state to figure out which ones to delete. My current map when I move the boundary it clears and then selects a current extents of the map for a new batch of points and clears then add the points. It work great most of the time. However, I'm finding that if I click on the popup and the boundary moves slightly to fit the popup then the point disappears briefly and then re-appears closing my popup. So, I guess I need to implement some sort of state machine and then filter through all of the old points to delete what is not in the current view. Maybe I could add a buffer as well but then that all gets very complicated and possibly memory intensive.
The rough logic would be something like this...
init last =
select => current
current not in last => add to map
last not in current => delete from map
current in last => update on map (I could skip since my data set is fairly static)
set current = last
Ok, so it looks like I can use a node like node-red-contrib-differences to get the one side but what I really needs is a node that does something like the diff command. Does anyone have any ideas if such a node exists or how to even approach the diff problem with large lists of objects (~500) in node-red? I can envision a node where it takes two arrays as inputs (flow.stash, msg.payload) and has three outputs "add", "delete", and "common". But, I'm lost from there.
The command line already has two commands that have this capability diff and comm.
I'm sure that my solution is not the most efficient but I was able to get it to work for 99% of the cases. So, based on timing I had to "stash" the point list twice. I stash the point list from the flow to the msg before the diff so that the add and del can operate on the same stash without having to worry about one finishing before the other.
My only issue is when I hit my select LIMIT = 500 from PostgreSQL then my logic ends up deleting some random points (so just zoom in right!). So, I think the boundary needs a little buffer (~10%) and then the delete list should be calculated based on outside the buffer and not outside the select results.
There is one bug in the worldmap node where it resends the boundary on clear command so I had to add the "hasPoints" logic to work around an infinite loop issue. But, in general this is a great tool to display a large data set of points for users who don't have QGIS or ESRI.