Does node red have live plotting and tracking functionality for plotting gps data such as latitude and longitude on a world map for implementing into my case.my gps is sending live location in the debug window every 3 minutes.so just wanted to showcase onto a map.
Yes. Use the node-red-contrib-web-worldmap
yes @dceejay it requires name as mandatory attribute.how can we add that to our nodes?
Use a change node
yes it is available,in b/w which nodes should i add?and what property it requires
set search for-name":"24e124fffef0a78e(same as in payload)
replace with:GPS(random)
Is it right? and in between which nodes should i place
Set msg.payload.name to whatever you want
@dceejay yes did it,what next?
Please spend an hour or two watching the Node Red Essentials videos linked from the node red docs. That will save you (and us) time and will avoid you asking questions that you will later look back on with embarrassment.
and what did the msg end up like ? does it look like the format the map would need ?
flows (2).json (5.3 KB)
the change node will set the name attribute to apple in this case.but at what position should i fix this node in this case.?And we need to send name property along with data attribute into a single object.example
{
name:apple,
lat:89.78
lon:556.9
} this is the output
I can't see the change node in that picture ?
@dceejay i understand, according to u how should we set the flow to see the desired output
Will it work if we use join node to create a merged object in this case as it can merge key value pairs from one object into another?
my mqtt broker settings are these
broker address-maqiatto.com
port-1883
username-bachloo.rahul@gmail.com
password-ryanrahul
topic-bachloo.rahul@gmail.com/test
Sorry, I'm now lost. You started with an object with lat and lon, and wanted to add a name to it so you could show it on a map. I showed you how the change node could do that. No need to merge anything.
Ok no problem.Your approach is correct i was just assuming that it might be also a possibility.
set msg.payload.name is the change node which is inturn connected with mqtt node.
What ? I thought you wanted to change the decoded output and send it to the map. ?
yes i want to show latitude and longitude on map.but according to it we have to add a change node inorder to accomplish it.I tried on my flow the change node but it is not showing desired output instead it shows whole message as payload.
This was the second output what i got when i connected a function node before the change node
code in function node-
var t=JSON.parse(msg.payload);
msg.payload=t.name;
return msg;
The error says it all. the payload is NOT an object.
This is a very basic thing you could have discovered if you attached a debug node.
Anyhow, the lat
and lon
are created in the buffer-parser (you can see that if you click the debug message) so you need to apply the name to THAT payload - e.g. put the change node AFTER the buffer-parser (where the payload IS an object)
TBH, I think you would benefit from watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.