NodeRed live location

Here's a test flow with test-data from your screen-shot above.
ma-car

[{"id":"b6b1c6060c03f0a1","type":"inject","z":"e6f7c855bf7f6cc9","name":"Test inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Lat: 25.67 Lon: 29.78","payloadType":"str","x":240,"y":420,"wires":[["41692b35459812ed"]]},{"id":"41692b35459812ed","type":"function","z":"e6f7c855bf7f6cc9","name":"","func":"let parts = msg.payload.split(\" \");\nlet lat = parts[1];\nlet lon = parts[3];\n\nlet out = [];  // Declare an array\n\nlet id  = \"NEO-6m\";\n\nout.push({\"name\": id, \"lat\": lat, \"lon\": lon, \"layer\": \"NEO-6m\", \"icon\": \"ma-car\"});\n\nmsg.payload = out;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":420,"wires":[["620696059e87bec2"]]},{"id":"620696059e87bec2","type":"debug","z":"e6f7c855bf7f6cc9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":420,"wires":[]}]

I'm still learning JSONata, so I've used a simple 'split' on a space character in the function node.

EDIT
As @jbudd said below, you don't need to convert the lat/lon values, worldmap will accept text.

Let me know if it works for you?

Yes, I removed the date from my code. this shows the output from your test


and this original output

I don't want to confuse things even further, but you don't actually have to convert the lat and long values to numbers, the worldmap seems to accept these values as strings.

Edit - @dynamicdave already confirmed this.

it's working successfully


Thank you so much Mr. @dynamicdave

Yipppppeeee - success at last.
You can have some fun now.

1 Like

I've published a version of the question asked by @lord on Share Your Projects.

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