Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Pure Python geodesy tools

Project description

A pure Python implementation of geodesy tools for various ellipsoidal and spherical earth models using precision trigonometric, vector-based, elliptic and approximate methods for geodetic (lat-/longitude) and geocentric (ECEF cartesian) coordinates.

Transcribed from JavaScript originals by Chris Veness (C) 2005-2019 and several C++ classes by Charles F.F. Karney (C) 2008-2020 and published under the same MIT License.

There are three modules for ellipsoidal earth models, ellipsoidalKarney, -Vincenty and -Nvector and two for spherical ones, sphericalTrigonometry and -Nvector. Each module provides a geodetic LatLon and a geocentric Cartesian class with methods and functions to compute distance, area, perimeter, initial and final bearing, intermediate and nearest points, intersections of circles, path intersections, trilateration (by intersection, overlap and 3d), conversions and unrolling, among other things. For more information and further details see the documentation, the descriptions of Latitude/Longitude, Vincenty and Vector-based geodesy, the original JavaScript source or docs and the Python geographiclib.

Also included are modules for conversions to and from Cassini-Soldner, ECEF (Earth-Centered, Earth-Fixed cartesian), UPS (Universal Polar Stereographic), UTM (Exact and Universal Transverse Mercator) and Web Mercator (Pseudo-Mercator) coordinates, MGRS (NATO Military Grid Reference System) and OSGR (British Ordinance Survery Grid Reference) grid references, TRF (Terrestrial Reference Frames) and modules to encode and decode EPSG, Geohashes, Georefs (WGRS) and Garefs (GARS) .

Other modules provide Albers Equal-Area projections, azimuthal projections and Lambert conformal conic projections and positions (from John P. Snyder, Map Projections – A Working Manual, 1987), functions to clip a path or polygon of LatLon points using the Cohen-Sutherland and the Sutherland-Hodgman methods, functions to simplify or linearize a path of LatLon points (or a numpy array), including implementations of the Ramer-Douglas-Peucker, the Visvalingam-Whyatt and the Reumann-Witkam algorithms and modified versions of the former. Other classes interpolate the height of LatLon points and several Geoid models or compute various Fréchet or Hausdorff distances.

Installation

To install PyGeodesy, type pip install PyGeodesy or easy_install PyGeodesy in a terminal or command window.

Alternatively, download PyGeodesy-yy.m.d.zip from PyPI or GitHub, unzip the downloaded file, cd to directory PyGeodesy-yy.m.d and type python setup.py install. To run all PyGeodesy tests, type python test/run.py or type python test/unitTestSuite.py before or after installation.

Installation of geographiclib, numpy and scipy is optional. However, the former is required to use classes EquidistantKarney, GnomonicKarney, CassiniSoldner and Css and function toCss, for module ellipsoidalKarney classes LatLon and Cartesian and functions areaOf, intersections2 and perimeterOf and for the HeightIDWkarney interpolator. Both the latter are needed for the Geoid… and Height… interpolator classes, except the GeoidKarney and all HeightIDW… classes.

Documentation

In addition to the pygeodesy package, the PyGeodesy distribution files contain the tests, the test results (on macOS only) and the complete documentation generated by Epydoc using command line: epydoc --html --no-private --no-source --name=PyGeodesy --url=... -v pygeodesy.

Tests

The tests have been run with Python 3.9.0 (with geographiclib 1.50 only), Python 3.8.6 (with geographiclib 1.50, numpy 1.19.2 and scipy 1.5.2) and macOS’ Python 2.7.16 (and only numpy 1.16.6), all on macOS 10.15.7 Catalina and all in 64-bit only. The tests run with and without lazy import for Python 3. The results of those tests are included in the distribution files.

Test coverage has been measured with coverage 4.5.4 using Python 3.9.0 (with geographiclib 1.50 only), Python 3.8.6 (with geographiclib 1.50, numpy 1.19.2 and scipy 1.5.2) and macOS’ Python 2.7.16 (and only numpy 1.16.6). The full coverage report in HTML and a PDF summary are included in the distribution files.

The tests also ran with Python 2.7.14, 3.6.3, 3.7.1, 3.8.0 and PyPy 7.1.1 (Python 2.7.13 and 3.6.1) (and geographiclib 1.49 or 1.50) on Ubuntu 14.04 and with Python 3.7.3 (and geographiclib 1.49 or 1.50) on Debian 9 all in 64-bit only and with Python 2.7.15, 3.6.8, 3.7.2 and 3.8.0 (all with geographiclib 1.49 or 1.50) on Windows Server 2012R2 in both 32- and 64-bit.

A single-File and single-Directory application with pygeodesy has been bundled using PyInstaller 3.4 and 64-bit Python 3.7.3 and 3.7.4 on macOS 10.13.6 High Sierra.

Previously, the tests were run with Python 2.6.9 (and numpy 1.6.2), 2.7.10 (and numpy 1.8.0rc1), 2.7.13 thru 2.7.17 (and numpy 1.13.1, 1.14.0, 1.15.2, 1.16.2, 1.16.5 or 1.19.0, scipy 1.5.0), 3.5.3, 3.6.2 thru 3.6.5, 3.7.0, 3.7.2 thru 3.7.6, 3.8 thru 3.8.5, PyPy 6.0.0 (Python 2.7.13 and 3.5.3), PyPy 7.3.0 (Python 2.7.13 and 3.6.9) and Intel-Python 3.5.3 (and numpy 1.11.3) on MacOS X 10.10 Yosemite, MacOS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13.6 High Sierra, macOS 10.14 Mojave and/or macOS 10.15.3, 10.15.5 and 10.15.6 Catalina, with Pythonista 3.1 on iOS 10.3.3, 11.0.3, 11.1.2 and 11.3 on iPad4, with Pythonista 3.2 (with geographiclib 1.49 or 1.50 and numpy 1.8.0) on iOS 11.4.1, 12.0, 12.2 and 12.3 on iPad4, iPhone6 and/or iPhone10, all in 64-bit only and with 32-bit Python 2.6.6 on Windows XP SP3 and with 32-bit Python 2.7.14 on Windows 10 Pro.

Notes

All Python source code has been statically checked with PyChecker, PyFlakes, PyCodeStyle (formerly Pep8) and McCabe using Python 2.7.18 and with Flake8 using Python 3.9.0, both in 64-bit on macOS 10.15.6 Catalina.

Classes with a name ending in -Karney and several more are transcribed from Karney’s C++ classes or require Karney’s geographiclib package to be installed. A complete list is in module karney.

Some function and method names differ from the JavaScript version. In such cases documentation tag JS name: shows the original JavaScript name.

Last updated: Oct 16, 2020.

License

Copyright (C) 2016-2020 -- mrJean1 at Gmail -- All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

https://Img.Shields.io/pypi/pyversions/PyGeodesy.svg?label=Python https://Img.Shields.io/appveyor/ci/mrJean1/PyGeodesy.svg?branch=master&label=AppVeyor https://Img.Shields.io/cirrus/github/mrJean1/PyGeodesy?branch=master&label=Cirrus https://Img.Shields.io/travis/mrJean1/PyGeodesy.svg?branch=master&label=Travis https://Img.Shields.io/badge/coverage-96%25-brightgreen https://Img.Shields.io/pypi/v/PyGeodesy.svg?label=PyPI https://Img.Shields.io/pypi/wheel/PyGeodesy.svg https://Img.Shields.io/pypi/l/PyGeodesy.svg

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PyGeodesy, version 20.10.16
Filename, size File type Python version Upload date Hashes
Filename, size PyGeodesy-20.10.16-py2.py3-none-any.whl (437.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size PyGeodesy-20.10.16.zip (5.2 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page