c++ library to convert from cartesian system to latitude, longitude and altitude
I'm looking for a c++ library that can be used to convert from Cartesian or spherical coordinates into a latitude, longitude, and altitude around the earth. However, the altitude must be exact. This means the library can't settle for assuming that the earth is spherical when doing the calculations, and it must be able to handle heights above the surface of the earth.
So far I have found two libraries which look like they may potentially do this (GeographicLib and GeoStarsLib) but both appear to be small projects that haven't been properly veted. I would be more comfortable with a larger project开发者_StackOverflow or one which I know has gone through some form of vetting so we can trust the output without detailed testing. I did find boost. geography, but from what I can tell it doesn't calculate geographic altitude.
Can anyone suggest any other library?
Thank you
Also look at Proj.4 and GDAL/OGR. I find the latter to be more useful as it includes Proj.4 but adds various useful functions to read various formats (incl. Projection definitions). Re. Spherical approximations: Proj.4 will use whatever ellipsoid you throw at it (Google assumes a sphere for most things).
I am the author of one of the libraries mentioned, GeographicLib. Your concerns are certainly reasonable ones. Let me point out a few reasons why GeographicLib might answer your needs:
GeographicLib has the functionality you want, via the Geocentric class (you might also investigate the LocalCartesian and Geoid classes).
The library is actively maintained by me. Bugs are rare and are typically fixed within days of their being reported.
The library is small and self-contained. It does not depend on a dozen additional libraries.
GeographicLib adheres to standards of accuracy which are typically higher than geotrans or proj.4. I measure the errors by comparing the results against test data obtained by high-precision calculations, and I report these errors in the documentation.
Note added in response to @rashad's query: The page where the errors are reported is here. This page also describes how the errors are measured.
I wonder if the google maps APIs might offer what you seek:
http://code.google.com/apis/earth/documentation/reference/interface_kml_point.html
I see references to KmlAltitutudeGeometry when reviewing the documentation.
精彩评论