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

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.

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

Please provide a small flow demonstrating the problem.

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.

Thanks dceejay, that works.

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": {

    }
};

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

1 Like

Nice ! Looks good

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