
=========
PyGeodesy
=========

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

Transcribed from `JavaScript originals`_ by *Chris Veness (C) 2005-2016*
and several `C++ classes`_ by *Charles Karney (C) 2008-2017* 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 *LatLon* class with methods and
functions to compute distance, initial and final bearing, intermediate
and nearest points, area, perimeter, 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`_,
UTM_ (Universal Transverse Mercator), UPS_ (Universal Polar Stereographic)
and `Web Mercator`_ (Pseudo-Mercator) coordinates, MGRS_ (NATO Military
Grid Reference System) and OSGR_ (British Ordinance Survery Grid Reference)
grid references and a module for encoding and decoding EPSG_, Geohashes_,
`Georefs (WGRS)`_ and `Garefs (GARS)`_ .

Other modules provide Lambert conformal conic projections and positions
(from `John P. Snyder`_, *Map Projections -- A Working Manual*, 1987, pp
107-109), 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 and classes to interpolate_ the height of
*LatLon* points and several *Geoid* models.

Testing
=======

All Python source code has been statically checked_ with PyChecker_,
PyFlakes_, PyCodeStyle_ (formerly Pep8) and McCabe_ using Python 2.7.16
and with Flake8_ using Python 3.7.3, both in 64-bit on macOS 10.13.6
High Sierra.

The tests have been run with Python 2.7.16 and 3.7.3 (both with
geographiclib_ 1.49, numpy_ 1.16.1, and scipy_ 1.2.1) and with PyPy_
6.0.0 (Python 2.7.13 and 3.5.3) on macOS 10.13.6 High Sierra.  The
results of those tests are included in the distribution files.

The tests also run with Python 2.6.9, 2.7.14, 3.5.6 and 3.6.3 (and
geographiclib_ 1.49) on `Ubuntu 14.04`_ and with Python 3.7.3 (and
geographiclib_ 1.49) on `Debian 9`_, *all in 64-bit only* and with
Python 2.7.15, 3.6.8 and 3.7.2 (all with geographiclib_ 1.49) on
`Windows Server 2012R2`_ *in both 32- and 64-bit*.

On Python 3.7+, the tests run with and without *lazy import*.

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, 2.7.14, 2.7.15 (and numpy 1.13.1, 1.14.0 or
1.15.2), 3.5.3, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.7.0, 3.7.2 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.5 High Sierra and macOS 10.14
Mojave, with Pythonista_ 3.1 on iOS 10.3.3, 11.0.3, 11.1.2 and 11.3 on
iPad4, with Pythonista_ 3.2 on iOS 11.4.1 and 12.0 on iPad4, iPhone7
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.

Documentation
=============

In addition to the PyGeodesy_ package, the 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``.

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 setup.py test``
before installation.

Installation of `GeographicLib`_, `NumPy`_ and `SciPy`_ is optional.
However, the former is required for module *css* classes *CassiniSoldner*
and *Css* and function *toCss* and for module *ellipsoidalKarney* classes
*LatLon* and *Cartesian* and functions *areaOf* and *perimeterOf*.  The
latter are needed for the *Geoid...* and *Height...* interpolators, except
*GeoidKarney*, *HeightIDW*, *HeightIDW2* and *HeightIDW3*.

Notes
=====

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

*Last updated: June 14, 2019.*

Copyright and License
=====================

``Copyright (C) 2016-2019 -- mrJean1 at Gmail dot com``

``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.``

.. image:: http://Img.Shields.io/pypi/pyversions/PyGeodesy.svg?label=Python
  :target: http://PyPI.org/project/PyGeodesy
.. image:: http://Img.Shields.io/appveyor/ci/mrJean1/PyGeodesy.svg?branch=master&label=AppVeyor
  :target: http://CI.AppVeyor.com/project/mrJean1/PyGeodesy/branch/master
.. image:: http://Img.Shields.io/travis/mrJean1/PyGeodesy.svg?branch=master&label=Travis
  :target: http://Travis-CI.org/mrJean1/PyGeodesy
.. image:: http://API.Cirrus-CI.com/github/mrJean1/PyGeodesy.svg?branch=master&label=Cirrus
  :target: http://Cirrus-CI.com/github/mrJean1/PyGeodesy
.. image:: http://Img.Shields.io/pypi/v/PyGeodesy.svg?label=PyPI
  :target: http://PyPI.org/project/PyGeodesy
.. image:: http://Img.Shields.io/pypi/wheel/PyGeodesy.svg
  :target: http://PyPI.org/project/PyGeodesy/#files
.. image:: http://Img.Shields.io/pypi/l/PyGeodesy.svg
  :target: http://PyPI.org/project/PyGeodesy

.. _C++ classes: http://GeographicLib.SourceForge.io/html/annotated.html
.. _Cassini-Soldner: http://GeographicLib.SourceForge.io/html/classGeographicLib_1_1CassiniSoldner.html
.. _checked: http://GitHub.com/ActiveState/code/tree/master/recipes/Python/546532_PyChecker_postprocessor
.. _Cohen-Sutherland: http://WikiPedia.org/wiki/Cohen-Sutherland_algorithm
.. _Debian 9: http://Cirrus-CI.com/github/mrJean1/PyGeodesy/master
.. _docs: http://www.Movable-Type.co.UK/scripts/geodesy/docs
.. _documentation: http://mrJean1.GitHub.io/PyGeodesy
.. _EPSG: http://www.EPSG-Registry.org
.. _Epydoc: http://PyPI.org/project/epydoc
.. _Flake8: http://PyPI.org/project/flake8
.. _Garefs (GARS): http://WikiPedia.org/wiki/Global_Area_Reference_System
.. _geographiclib: http://PyPI.org/project/geographiclib
.. _Geohashes: http://www.Movable-Type.co.UK/scripts/geohash.html
.. _Georefs (WGRS): http://WikiPedia.org/wiki/World_Geographic_Reference_System
.. _GitHub: http://GitHub.com/mrJean1/PyGeodesy
.. _Intel-Python: http://software.Intel.com/en-us/distribution-for-python
.. _interpolate: http://docs.SciPy.org/doc/scipy/reference/interpolate.html
.. _JavaScript originals: http://GitHub.com/ChrisVeness/geodesy
.. _JavaScript source: http://GitHub.com/ChrisVeness/geodesy
.. _John P. Snyder: http://pubs.er.USGS.gov/djvu/PP/PP_1395.pdf
.. _Latitude/Longitude: http://www.Movable-Type.co.UK/scripts/latlong.html
.. _McCabe: http://PyPI.org/project/mccabe
.. _MGRS: http://www.Movable-Type.co.UK/scripts/latlong-utm-mgrs.html
.. _MIT License: http://OpenSource.org/licenses/MIT
.. _numpy: http://PyPI.org/project/numpy
.. _NumPy array: http://docs.SciPy.org/doc/numpy/reference/generated/numpy.array.html
.. _OSGR: http://www.Movable-Type.co.UK/scripts/latlong-os-gridref.html
.. _PyChecker: http://PyPI.org/project/pychecker
.. _PyCodeStyle: http://PyPI.org/project/pycodestyle
.. _PyFlakes: http://PyPI.org/project/pyflakes
.. _PyGeodesy: http://PyPI.org/project/PyGeodesy
.. _PyPI: http://PyPI.org/project/PyGeodesy
.. _PyPy: http://PyPy.org
.. _Pythonista: http://OMZ-Software.com/pythonista
.. _Ramer-Douglas-Peucker: http://WikiPedia.org/wiki/Ramer-Douglas-Peucker_algorithm
.. _Reumann-Witkam: http://psimpl.SourceForge.net/reumann-witkam.html
.. _SciPy: http://SciPy.org
.. _simplify: http://Bost.Ocks.org/mike/simplify
.. _Sutherland-Hodgman: http://WikiPedia.org/wiki/Sutherland-Hodgman_algorithm
.. _Ubuntu 14.04: http://Travis-CI.org/mrJean1/PyGeodesy
.. _UPS: http://WikiPedia.org/wiki/Universal_polar_stereographic_coordinate_system
.. _UTM: http://www.Movable-Type.co.UK/scripts/latlong-utm-mgrs.html
.. _Vector-based: http://www.Movable-Type.co.UK/scripts/latlong-vectors.html
.. _Vincenty: http://www.Movable-Type.co.UK/scripts/latlong-vincenty.html
.. _Visvalingam-Whyatt: http://hydra.Hull.ac.UK/resources/hull:8338
.. _Web Mercator: http://WikiPedia.org/wiki/Web_Mercator
.. _Windows Server 2012R2: http://CI.AppVeyor.com/project/mrJean1/pygeodesy
