Hello,
I am new using Node-RED, I have a problem with fixing marker in Worldmap node with using a realtime data. I can solve it if I directly write the number of lat and lon and feed them to worldmap-UI through a function with if-statement if msg.payload.action = true.
I tried to store a live data of latitude and longitude to a new variable. I thought it will work since
const lati = msg.payload.latitude //lat value from the device
const longi = msg.payload.longitude //lon value from the deviceif (msg.payload.action = true)
{
msg.payload = {
"lat": lati,
"lon": longi,
"name" : "myMarker"
}
}
return msg;
What i realized is the msg.payload.lat and msg.payload.lon values will become undefined if there is a change of event (for example if I go to another tab in the UI). Therefore the marker will be gone. it will be back if I receive a realtime data from the device.
Is there any solution to fix the marker from a realtime data? Thank you!
I have read this similar problem