Change the content of a GPS-Object to fit in worldmap

Hi, im Beginner here and make my first steps with node red and want to show vessels on a map.

I managed to show a first Vessel on my map. It sends out of a Installation of Venus OS from a Raspberry. Victron provides special GPS Nodes for that.

The second Test is a ESP32, that sends Position via MQTT, but the format of the Message is not recognized by the Worlmap.

Worldmap expects a JSON like

{"lon":xx.xxx,"lat":yy.yyy,"name":"TAXI1"}

but i get Messages as follows:

{"ESPtracker1/position/lon":xx.xxxxx,"ESPtracker1/position/lat":yy.yyyyy,"name":"TAXI2"}

I import Lat and Lon in two different MQTT-in-nodes plus a Inject Node for the Name. Then put all together in a Join Node.

How can i change the "ESPtracker1/position/lat" to just lat ? And should this be done before oder after the join node?

Or is it posible to just remove the "ESPtracker1/position/" Part out of the msg?

I reviewed some JSON Tutorials, but without any Programming skills, its hard to find the solution for me, sorry! And thanks in advance! :slight_smile:

Hi and welcome.

You can move msg properties using an change node.
e.g
move msg. payload.ESPtracker1/position/lon
to msg payload.lon

You may get some more insights by watching essentials videos made by the node-red developers.
[edit] JSON is a text string, messages are Javascript object. There is a difference. JavaScript Object vs JSON: Demystified - DEV Community

Thank you! I tried that before. I tried change nodes, with move, replace, delete Options. Always got an error message. A change node that moves the payload as suggested leads to an Error: "Cannot set property of non-object type: payload.lon".

I tried to make it a string, or a object, or whatsoever. And i read some of these Tutorials / Guides. But did not understand.

With all due respect, from my point of view as a Captain: I could send you some Links how to learn rendering a steering course on a Paper-Seamap, where navigating a Ship over the Ocean is explained easy, but you would not be able to arrive at your destination tomorrow after reading some Books. :wink:

Same for me here. I wondered how could it be done to cut the first 21 letters of a string, add a ":" after the end. Or if there is a better way, eg kind of search and replace like in a Text Programm.

I tried to cascade changenodes, making it a string first, cut a part, convert it back to somewhat else, but whatever i tried i got suprising, but wrong results...

So please, can someone provide me an example for my case? :slight_smile:

Please show the object in an expanded debug panel, as what you provided lead me to assume that the object was in payload.
Better still would be an example flow with the incoming object set in inject nodes.

The videos are not read they are watched and they will give you the basics so you would understand the difference between objects and string etc.

Looks to me like you are working with an incoming msg that may be a JSON (string). So you will need to convert it to an object ( json node works here ), or depending how the message arrives have the node that receives it output an object (mqtt should auto detect and output an object, so something is off here).

This video was released just a few days ago. It covers using worldmap in FlowFuse Dashboard.

While that may not be what you are using, it should have plenty of clues for you.


I concur. These are the set of videos we often recommend. They have a ton of tips that make it all "come together" - kinda subliminally teaching you things like what an object is, what an objects properties look like, how to access them and a whole bunch of other really useful tid bits that usually sparks something in those willing to watch them. Of course, you dont have to :man_shrugging:

That is just a change node. If you have watched the recommended vids, you will know what I am saying here: Use a change node to move the values around using the copy path feature...

chrome_Mdq7pEMWIu

Wow, thank you very much, your help is so much appreciated! Youre both absolutly right, its way better to understand what to do than just copy a provided snippet.

The Video you made for me is exactly what i needed to go into the right direction and i think i would be able to solve my Problem just with your Video. But after watching the first 15 Min of the linked Youtube Video I just decided to watch this first, before i try the change node in my little Project, to get some Essentials and cool Tricks first! :slight_smile:

Thanks again! I will come back here when all is running, to thank you again!

2 Likes