# Worldmap shows on the right position, but on the wrong spot

**URL:** https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783
**Category:** General
**Tags:** node-red-contrib-web-worldmap
**Created:** [30 October 2024 02:09 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783 "2024-10-30T02:09:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Nice\_to\_have](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nice\_to\_have](https://discourse.nodered.org/u/Nice_to_have)
#### Post date: [30 October 2024 02:09 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783/1 "2024-10-30T02:09:38Z")

</div>

Hi All,

I wanted to plot the GPS satelittes that my GPS sees on world map.  
Although my GPS sees 10, it only showed 4 on the map....... Untill I zoomed out.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/d/dd8131a857a910a5298f3f64654a816a877592cb.jpeg)

How can I get them to show them around me, instead of the other (also correct) half of the world?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [30 October 2024 07:29 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783/2 "2024-10-30T07:29:44Z")

</div>

Please provide a small flow demonstrating the problem.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [30 October 2024 13:20 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783/3 "2024-10-30T13:20:03Z")

</div>

Generally longitude goes from -180 to +180 - but the map will happily display \>180 if you like - so you probably need to "shift" any points with longitudes below 0 . IE add 360 to them to make them +ve.

---

<div class="post-metadata">

### Author: ![Nice\_to\_have](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nice\_to\_have](https://discourse.nodered.org/u/Nice_to_have)
#### Post date: [30 October 2024 19:15 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783/4 "2024-10-30T19:15:03Z")

</div>

Thanks dceejay, that works.

```auto
if (global.get("Data.Com1.nav.position.dd.lon") < 0 && msg.payload.above.satlng < 0) {
    msg.payload.above.satlng += 360;
}

msg.payload = {
    "name": msg.payload.above.satname,
    "lat": msg.payload.above.satlat,
    "lon": msg.payload.above.satlng,
    "icon": "satellite",
    "iconColor": "green",
    "alt": msg.payload.above.satalt + "KM",
    "layer": "Satellite",
    "command": {

    }
};

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4628aaf796af8f84a8882606d0f5e484b5865c1.jpeg)

After your solution, I noticed that when I make a marker on the left of the map I get a negative longitude and on the right side I get a positive longitude.  
My added IF statement makes sure the map always shows them near me.

Thanks

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [30 October 2024 22:52 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783/5 "2024-10-30T22:52:34Z")

</div>

Nice ! Looks good

---

<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: [13 November 2024 22:53 UTC](https://discourse.nodered.org/t/worldmap-shows-on-the-right-position-but-on-the-wrong-spot/92783/6 "2024-11-13T22:53:03Z")

</div>

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