Difference between revisions of "Geographic Coordinate Systems"
m (http://www.mailarchive.com/flightgeardevel@lists.sourceforge.net/msg10525.html) 
m 

Line 26:  Line 26:  
== Conversion ==  == Conversion ==  
+  
+  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 <code>SGGeodesy</code>, to be found in <code>simgear/math/SGGeodesy.hxx</code>:  The [[SimGear]] library provides static methods for conversion in the class <code>SGGeodesy</code>, to be found in <code>simgear/math/SGGeodesy.hxx</code>: 
Revision as of 03:29, 27 July 2012
FlightGear uses a set of different coordinate systems to express geographic locations. All these coordinates are based on the WGS84 Ellipsoid.
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.
Contents
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 positionproperties 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 zaxis aligned with the earth axis pointing north,
 the xaxis going through the Greenwich Meridian at its intersection with the equator, and
 the yaxis going through the intersection of the meridian at 90 degrees east and the equator.
Conversion
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 simgear/math/SGGeodesy.hxx
:

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 SGGeod
and SGGeoc
(found in simgear/math/SGGeod.hxx
and 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.
External links
