Geographic Coordinate Systems
Scenery layout, airports, runways, navaids, aircraft positions, and all that sort of stuff is all based on WGS84. There are some additional coordinate systems that FlightGear uses internally, but that is typically hidden deep inside the code.
Geocentric and Geodetic Coordinates
Both geocentric and geodetic coordinates are expressed as a triple of latitude, longitude and altitude. In both cases, altitude is the height of the respective point above the surface of the Ellipsoid and longitude is the angle between the planes parallel to the earth axis and passing through the Greenwich Meridian respectively the point designated by the coordinates.
The difference between geocentric and geodetic coordinates lies in the definition of latitude:
- In geocentric coordinates latitude is the angle between the equatorial plane and the line crossing through the earth's center and the point designated by the coordinates.
- In geodetic coordinates latitude is the angle between the equatorial plane and the normal at the designated point, i.e. the vector standing perpendicular on the Ellipsoid at the designated point.
Note: The position-properties under /position in the property tree are geodetic coordinates.
Cartesian Geocentric Coordinates
Cartesian geocentric coordinates are defined in terms of a cartesian coordinate system with
- the center of the earth being the origin,
- the z-axis aligned with the earth axis pointing north,
- the x-axis going through the Greenwich Meridian at its intersection with the equator, and
- the y-axis going through the intersection of the meridian at 90 degrees east and the equator.
This is also call the Earth-Centered Earth-Fixed coordinate system.
The essential maths required to convert coordinates are covered at: http://williams.best.vwh.net/avform.htm
The SimGear library provides static methods for conversion in the class
SGGeodesy, to be found in
SGGeodesy::SGCartToGeod(const SGVec3<double>& cart, SGGeod& geod)converts a cartesian point to geodetic coordinates.
SGGeodesy::SGGeodToCart(const SGGeod& geod, SGVec3<double>& cart)converts a geodetic point to cartesian coordinates.
SGGeodesy::SGCartToGeoc(const SGVec3<double>& cart, SGGeoc& geoc)converts a cartesian point to geocentric coordinates.
SGGeodesy::SGGeocToCart(const SGGeoc& geoc, SGVec3<double>& cart)converts a geocentric point to cartesian coordinates.
Further, the classes
SGGeoc (found in
simgear/math/SGGeoc.hxx, respectively) provide static conversion methods for convenience, which use the methods listed above.
Note that most of these conversions are expensive to compute - check the external links to see how it works.