geographiclib

Author: Charles F. F. Karney (charles@karney.com)

Version: 1.52

The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/python/ for versions numbers m.nn ≥ 1.46.

Licensed under the MIT/X11 License; see LICENSE.txt.

Introduction

This is a python implementation of the geodesic routines in GeographicLib.

Although it is maintained in conjunction with the larger C++ library, this python package can be used independently.

Installation

The full Geographic package can be downloaded from sourceforge. However the python implementation is available as a stand-alone package. To install this, run

pip install geographiclib

Alternatively downloaded the package directly from Python Package Index and install it with

tar xpfz geographiclib-1.52.tar.gz
cd geographiclib-1.52
python setup.py install

It’s a good idea to run the unit tests to verify that the installation worked OK by running

python -m unittest geographiclib.test.test_geodesic

Contents

GeographicLib in various languages

Change log

  • Version 1.52 (released 2021-06-22)

    • Work around inaccurate math.hypot for python 3.[89]

    • Be more aggressive in preventing negative s12 and m12 for short lines.

  • Version 1.50 (released 2019-09-24)

    • PolygonArea can now handle arbitrarily complex polygons. In the case of self-intersecting polygons the area is accumulated “algebraically”, e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel.

    • Fixed bug in counting pole encirclings when adding edges to a polygon.

    • Work around problems caused by sin(inf) and fmod(inf) raising exceptions.

    • Math.cbrt, Math.atanh, and Math.asinh now preserve the sign of −0.

  • Version 1.49 (released 2017-10-05)

    • Fix code formatting; add tests.

  • Version 1.48 (released 2017-04-09)

    • Change default range for longitude and azimuth to (−180°, 180°] (instead of [−180°, 180°)).

  • Version 1.47 (released 2017-02-15)

    • Fix the packaging, incorporating the patches in version 1.46.3.

    • Improve accuracy of area calculation (fixing a flaw introduced in version 1.46)

  • Version 1.46 (released 2016-02-15)

    • Add Geodesic.DirectLine, Geodesic.ArcDirectLine, Geodesic.InverseLine, GeodesicLine.SetDistance, GeodesicLine.SetArc, GeodesicLine.s13, GeodesicLine.a13.

    • More accurate inverse solution when longitude difference is close to 180°.

    • Remove unnecessary functions, CheckPosition, CheckAzimuth, CheckDistance.

Indices and tables