1

I'm working on a simulator that plots the flight path of an aircraft on Google Maps.

The simulator is not aware that the latitude is only defined between -90 and +90 degrees and the longitude between -180 and +180 deg. As a result of this, the flight path may include points beyond the map boundaries. Exceeding in longitude is not an issue as it still plots correctly (a point at longitude x and x+360 is the same), but the latitude is a problem.

Is there any way of telling Google Maps to keep the points between the correct boundaries and plot them correctly?

Otherwise, do you have any ideas of where to find functions that do so?

1
  • I don't really undestrand the question, Google Maps also uses latitude & longitude as you described.
    – XCS
    Commented Dec 8, 2012 at 20:28

2 Answers 2

2

Longitude, latitude and elevation are a bad coordinate system for a flight simulator, because the mapping presents singularities i.e. there are points infinitely close on the earth that have very different coordinates. For example where you're close to one of the poles longitude variation speed can become arbitrarily big compared to airplane speed. When standing exactly on the pole the longitude doesn't even make sense.

A better solution is to use an XYZ coordinate system for the simulator and only convert to longitude/latitude and elevation for plotting. If you can approximate the earth to a sphere for your use case the computation of this transformation is trivial... otherwise things can get much more complex depending on how accurate you want it to be.

That said it's still possible to give "a" meaning to a point with latitude slightly outside the range -90...90 by extending it over the pole...

if latitude < -90:
    latitude = -180 - latitude
    longitude = longitude + 180
if latitude > 90:
    latitude = 180 - latitude
    longitude = longitude + 180

but using this coordinate system for navigating is a very bad idea (the same point in space can have multiple triplets of coordinates).

2
  • The simulator does work in XYZ coordinates and I am using Lat and Lon just for plotting. For some reason I imagined the mapping to be more complicated than that! Your solution looks like it can work! Thanks!
    – nzapponi
    Commented Dec 8, 2012 at 21:02
  • I highly recommend that you do NOT go beyond 90 deg lat to make the math work. Going from lat/lon (geodetic) to XYZ (ECEF) is trivial. It is not trivial to go from ECEF to geodetic around the poles.
    – TreyA
    Commented Dec 9, 2012 at 13:06
1

If your simulator doesn't know that the maximum value for latitude is 90 degrees it is broken and needs to be fixed. Google Maps works correctly for valid/possible values of latitude and longitude.

Not the answer you're looking for? Browse other questions tagged or ask your own question.