# NodeRed live location

**URL:** <https://discourse.nodered.org/t/nodered-live-location/63085>\
**Category:** General\
**Tags:** function-node\
**Created:** [26 May 2022 02:33 UTC](https://discourse.nodered.org/t/nodered-live-location/63085 "2022-05-26T02:33:31Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 May 2022 07:59 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/21 "2022-05-26T07:59:29Z")

</div>

Here's a test flow with test-data from your screen-shot above.  
 ![ma-car](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/94be080f562aaf73a1c7592ceedfc109a6a4b264.png)

```auto
[{"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?

---

<div class="post-metadata">

**Author:** ![lord](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lord](https://discourse.nodered.org/u/lord)\
**Post date:** [26 May 2022 08:01 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/22 "2022-05-26T08:01:13Z")

</div>

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

 ![2022-05-26 (8)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/986764737e42c97d85eb35419ec11388ec8f212f.jpeg)  
and this original output  
 ![2022-05-26 (7)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/b/dbab2a0740dec767296351f3cc0fdf1b18c2c49e.jpeg)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 May 2022 08:03 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/23 "2022-05-26T08:03:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lord](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lord](https://discourse.nodered.org/u/lord)\
**Post date:** [26 May 2022 08:10 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/24 "2022-05-26T08:10:43Z")

</div>

it's working successfully

 ![2022-05-26 (9)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f99732b75e55fb61eb6553a1b7bbb870e59b6eda.jpeg)  
Thank you so much Mr. @dynamicdave

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 May 2022 08:12 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/25 "2022-05-26T08:12:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 May 2022 13:07 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/26 "2022-05-26T13:07:24Z")

</div>

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

> [@Show the current position of the International Space Station (ISS)](https://discourse.nodered.org/t/show-the-position-of-the-international-space-station-iss/63106):
>
> This is a spin-off from a question I answered for someone on the forum recently. I thought it would make a great fill-in exercise for any of my IoT students who have a few minutes to spare towards the end of a session of my IoT Club. Here's a screen-shot of a simple dashboard - I'm sure most people could improve it. [ISS\_flow] [{"id":"7969e7f53683abdf","type":"debug","z":"a9b12d67e974b017","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"t…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 June 2022 13:08 UTC](https://discourse.nodered.org/t/nodered-live-location/63085/27 "2022-06-09T13:08:07Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/nodered-live-location/63085.md?page=1)
