Skip to content

mrJean1/PyGeodesy3

Repository files navigation

PyGeodesy3

A pure Python implementation of geodesy tools for various ellipsoidal and spherical earth models using precision trigonometric, vector-based, exact, elliptic, iterative and approximate methods for geodetic (lat-/longitude), geocentric (ECEF cartesian) and certain triaxial ellipsoidal coordinates, supported only on Python 3.7 or newer.

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

There are four modules for ellipsoidal earth models, ellipsoidal.exact, .karney, .vincenty and .nvector and two for spherical ones, spherical.trigonometry and .nvector. Each module provides a geodetic LatLon and a geocentric Cartesian class with methods and functions to compute distance, surface area, perimeter, initial and final bearing, intermediate and nearest points, circle intersections and secants, path intersections, 3-point resections, rhumb and rhumb lines, triangulation, trilateration (by intersection, by overlap and in 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 Karney's Python geographiclib and C++ GeographicLib.

Also included are modules for conversions to and from Cassini-Soldner, ECEF (Earth-Centered, Earth-Fixed cartesian), UTM (Universal Transverse Mercator and Exact), UPS (Universal Polar Stereographic) and Web Mercator (Pseudo-Mercator) coordinates, MGRS (Military Grid Reference System, UTM and UPS) 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, equidistant and other azimuthal projections, Lambert conformal conic projections and positions, functions to clip paths or polygons of LatLon points using the Cohen-Sutherland, Forster-Hormann-Popa, Greiner-Hormann, Liang-Barsky and Sutherland-Hodgman methods or to perform boolean operations between (composite) polygons, functions to simplify or linearize a path of LatLon points (or a numpy array), including implementations of the Ramer-Douglas-Peucker, Visvalingam-Whyatt and Reumann-Witkam algorithms and modified versions of the former. Other classes interpolate the Height of LatLon points and Geoid models or compute distances using Fréchet, Hausdorff and various formulae.

Installation

To install PyGeodesy3, type python3 -m pip install PyGeodesy3 or python3 -m easy_install PyGeodesy3 in a terminal or command window.

If the wheel PyGeodesy3-yy.m.d-py3-none-any.whl is missing in PyPI Download files, download the file from GitHub/dist. Install that with python3 -m pip install <path-to-downloaded-wheel> and verify with python3 -m pygeodesy3.

Alternatively, download PyGeodesy3-yy.m.d.zip from PyPI or GitHub, unzip the downloaded file, cd to directory PyGeodesy3-yy.m.d and type python3 setup.py install.

To run all PyGeodesy3 tests, type python3 test/run.py before or after installation.

Dependencies

Installation of Karney's Python package geographiclib is optional, but required to use modules ellipsoidal.karney and projections.css, projections.azimuthal classes EquidistantKarney and GnomonicKarney and the HeightIDWkarney interpolator.

Both numpy and scipy must be installed for most Geoid and Height interpolators, except GeoidKarney and the HeigthIDW... ones.

Functions and LatLon methods circin6, circum3, circum4_, soddy4, trilaterate3d2 and trilaterate5 do and modules maths.auxilats and rhumb.aux_ may require numpy.

Modules ellipsoidal.solve and geodesic.solve and projections.azimuthal classes EquidistantGeodSolve and GnomonicGeodSolve depend on Karney's C++ utility GeodSolve to be executable and set with env variable PYGEODESY3_GEODSOLVE or with property Ellipsoid.geodsolve.

To compare MGRS results from modules grids.mgrs and test.testMgrs with Karney's C++ utility GeoConvert, the latter must be executable and set with env variable PYGEODESY3_GEOCONVERT.

Module rhumb.solve needs Karney's C++ utility RhumbSolve to be executable and set with env variable PYGEODESY3_RHUMBSOLVE or with property Ellipsoid.rhumbsolve.

Documentation

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

Tests

The tests ran with Python 3.12.2 (with geographiclib 2.0), 3.11.5 (with geographiclib 2.0, numpy 1.24.2 and scipy 1.10.1), Python 3.10.8 (with geographiclib 2.0, numpy 1.23.3, scipy 1.9.1, GeoConvert 2.2, GeodSolve 2.2 and RhumbSolve 2.2) and Python 3.9.6, all on macOS 14.3.1 Sonoma, Apple M1 Silicon (arm64), natively and in 64-bit only.

All tests ran with lazy import enabled and with command line option -W default and env variable PYGEODESY_WARNINGS=on. The results of those tests are included in the distribution files.

Test coverage has been measured with coverage 7.2.2. The complete coverage report in HTML and a PDF summary are included in the distribution files.

The tests also ran with Python 3.11.5 (and geographiclib 2.0) on Debian 11 in 64-bit only and with Python 3.11.5 and 3.10.10 (all with geographiclib 1.52) on Windows 10 in 64- and/or 32-bit.

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.11.5, both in 64-bit on macOS 14.3.1 Sonoma.

For a summary of all Karney-based functionality in pygeodesy3, see module karney.

Last updated: March 03, 2024.

License

Copyright (C) 2024-2024 -- 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/PyGeodesy3.svg?label=Python https://Img.Shields.io/appveyor/ci/mrJean1/PyGeodesy3.svg?branch=master&label=AppVeyor https://Img.Shields.io/cirrus/github/mrJean1/PyGeodesy3?branch=master&label=Cirrus https://Img.Shields.io/badge/coverage-95%25-brightgreen https://Img.Shields.io/pypi/v/PyGeodesy3.svg?label=PyPI https://img.shields.io/pypi/dm/PyGeodesy3

About

PyGeodesy Python 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages