Introduction
Forward to Installing GeographicLib. Up to Contents.

GeographicLib offers a C++ interfaces to a small (but important!) set of geographic transformations. It grew out of a desire to improve on the GEOTRANS package for transforming between geographic and MGRS coordinates. At present, GeographicLib provides UTM, UPS, MGRS, geocentric, and local cartesian projections, gravity and geomagnetic models, and classes for geodesic calculations.

The goals of GeographicLib are:

- Accuracy. In most applications the accuracy is close to round-off, about 5 nm (5 nanometers). Even though in many geographic applications 1 cm is considered "accurate enough", there is little penalty in providing much better accuracy. In situations where a faster approximate algorithm is necessary, GeographicLib offers an accurate benchmark to guide the development.
- Completeness. For each of the projections included, an attempt is made to provide a complete solution. For example, Geodesic::Inverse works for anti-podal points. Similarly, Geocentric::Reverse will return accurate geodetic coordinates even for points close to the center of the earth.
- C++ interface. For the projection methods, this allows encapsulation of the ellipsoid parameters.
- Emphasis on projections necessary for analyzing military data.
- Uniform treatment of UTM/UPS. The UTMUPS class treats UPS as zone 0. This simplifies conversions between UTM and UPS coordinates, etc.
- Well defined and stable conventions for the conversion between UTM/UPS to MGRS coordinates.
- Detailed internal documentation on the algorithms. For the most part GeographicLib uses published algorithms and references are given. If changes have been made (usually to improve the numerical accuracy), these are described in the code.

Various Utility programs are provided with the library. These illustrate the use of the library and are useful in their own right. This library and the utilities have been tested with C++11 compliant versions of g++ under Linux, with Apple LLVM 7.0.2 under Mac OS X, and with MS Visual Studio 14 (2015), 15 (2017), and 16 (2019) compiled for 32 bit and 64 bit on Windows.

The section Geodesics on an ellipsoid of revolution documents the method of solving the geodesic problem.

The section Transverse Mercator projection documents various properties of this projection.

The bulk of the testing has used geographically relevant values of the flattening. Thus, you can expect close to full accuracy for −0.01 ≤ f ≤ 0.01 (but note that TransverseMercatorExact is restricted to f > 0). However, reasonably accurate results can be expected if −0.1 ≤ f ≤ 0.1. Outside this range, you should attempt to verify the accuracy of the routines independently. Two types of problems may occur with larger values of f:

- Some classes, specifically Geodesic, GeodesicLine, and TransverseMercator, use series expansions using f as a small parameter. The accuracy of these routines will degrade as f becomes large.
- Even when exact formulas are used, many of the classes need to invert the exact formulas (e.g., to invert a projection), typically, using Newton's method. This usually provides an essentially exact inversion. However, the choice of starting guess and the exit conditions have been tuned to cover small values of f and the inversion may be incorrect if f is large.

Undoubtedly, bugs lurk in this code and in the documentation. Please report any you find to karne.nosp@m.y@al.nosp@m.um.mi.nosp@m.t.ed.nosp@m.u.

Forward to Installing GeographicLib. Up to Contents.