GeographicLib is a Python implementation of the geodesic routines from the larger C++ GeographicLib library. It provides accurate algorithms for solving direct and inverse geodesic problems, as well as calculating areas on an ellipsoid model of the Earth. The current version is 2.1, and it maintains a regular release cadence with updates tagged in its GitHub repository.
pip install geographiclibVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `Geodesic` class to calculate the inverse (distance and azimuth between two points) and direct (finding a point given a starting point, azimuth, and distance) geodesic problems using the WGS84 ellipsoid.
Migrate your Python environment to Python 3.7+.
Review code that processes longitude or azimuth values near the ±180° boundary and adjust for the new range if necessary.
Remove any custom workarounds for `Geodesic.WGS84` attribute access and use it directly as intended.
Be aware of the directional implications of positive and negative zero/180° in your calculations, especially for precise azimuth tracking or area computations involving `LONG_UNROLL`.
Install the library using pip: `pip install geographiclib`
Ensure the library is installed with `pip install geographiclib`. If already installed, there might be an environment issue, or a conflict; try reinstalling or checking your Python path.
Ensure that the `a` (equatorial radius) and `f` (flattening) parameters provided to `Geodesic` are valid positive floating-point numbers, for example, `Geodesic(a=6378137, f=1/298.257223563)`.
Ensure the geoid data files are correctly downloaded and placed in a directory where `GeographicLib` can find them. For C++ GeographicLib, this is often `/usr/share/GeographicLib/geoids` or a custom path. For Python, ensure the `Geoid` constructor is pointed to the correct data directory if not using the default. Also, if using `NETGeographicLib` in a multi-threaded context, pre-caching the geoid file using `CacheAll()` can resolve concurrency issues.