Skip to main content

Modules for working with points on Earth

Project description

Introduction

upoints is a collection of GPL v3 licensed modules for working with points on Earth, or other near spherical objects. It allows you to calculate the distance and bearings between points, mangle xearth/xplanet data files, work with online UK trigpoint databases, NOAA’s weather station database and other such location databases.

Previous versions of upoints were called earth_distance, but the name was changed as it no longer reflected the majority of uses the packages was targeted at.

Requirements

upoints’s only strict requirements beyond the Python standard library are aaargh and lxml, and as such should run with Python 2.6 or newer [1]. If upoints doesn’t work with the version of Python you have installed, drop me a mail and I’ll endeavour to fix it.

The modules have been tested on many UNIX-like systems, including Linux and OS X, but it should work fine on other systems too. The modules and scripts contain a large collection of tests that can be checked with nose2.

Example

The simplest way to show how upoints works is by example, and here goes:

>>> from upoints import point
>>> Home = point.Point(52.015, -0.221)
>>> Telford = point.Point(52.6333, -2.5000)
>>> print("%d kM, with an initial bearing of %d°"
...       % (Home.distance(Telford), Home.bearing(Telford)))
169 kM, with an initial bearing of 294°

All the class definitions, methods and independent functions contain hopefully useful usage examples in the docstrings. The API documentation is built with Sphinx, and is available in doc/html/api/.

There is some accompanying text and examples for point.py, formerly edist.py, available in geolocation and path cross. More examples are available for xearth.py in xearth and path cross. Some background and more examples for trigpoints.py is online in Trigpointing and point.py. Usage examples for cities.py is available in Cities and cities.py. And finally, Pythons on a plane contains information on weather_stations.py.

Thanks

The following people have submitted patches, testing and feedback:

  • Cédric Dufour - edist.py’s CSV import, and flight plan output

  • Thomas Traber - GPX support enhancements, Points filtering, and some cool usage scenarios

  • Kelly Turner - Xearth import idea, and copious testing

  • Simon Woods - Testing

API Stability

API stability isn’t guaranteed across versions, although frivolous changes won’t be made.

When upoints 1.0 is released the API will be frozen, and any changes which aren’t backwards compatible will force a major version bump.

Limitations

The modules assume the caller will take care of significant digits, and output formatting [2]. All results are returned with whatever precision your Python install or system generates; unintuitive float representation, rounding errors, warts and all.

The reasoning is simple, the caller should always know what is required and any heuristics added to the code would be just that – guesses, which can and will be wrong.

The upoints modules do not take flattening in to account, as in calculations based in most populated areas of the earth the errors introduced by ignoring the earth’s flattening are quite small. Future versions may change if the limitation becomes an issue in real use.

Although not really a limitation one should also be careful to use data sources that are based around the same datum, and even within two data sources that use the same datum you should make sure they use the same representations. It isn’t unusual to find data sources from the USA that specify longitudes west of Greenwich as positive for example.

Bugs

If you find a bug don’t hesitate to drop me a mail preferably including a minimal testcase, or even better a patch!

Project details


Download files

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

Source Distributions

upoints-0.12.1.tar.gz (499.2 kB view details)

Uploaded Source

upoints-0.12.1.tar.bz2 (487.7 kB view details)

Uploaded Source

Built Distribution

upoints-0.12.1-py2.py3-none-any.whl (72.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file upoints-0.12.1.tar.gz.

File metadata

  • Download URL: upoints-0.12.1.tar.gz
  • Upload date:
  • Size: 499.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for upoints-0.12.1.tar.gz
Algorithm Hash digest
SHA256 2b23799405329c3983916aefcf08a18bd002dabe26a9f0452fd00db21aa070f3
MD5 0d75727b0bc4e446a9a16f21d958da40
BLAKE2b-256 acb7261be7636d9356970aa14a1ecc0a49c8b4b64e30d5cc7667dcb7810c1b2e

See more details on using hashes here.

File details

Details for the file upoints-0.12.1.tar.bz2.

File metadata

  • Download URL: upoints-0.12.1.tar.bz2
  • Upload date:
  • Size: 487.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for upoints-0.12.1.tar.bz2
Algorithm Hash digest
SHA256 4f56c5c81560c2d9385d5bf166d58338e20a7e22d2a41fa22bc00c2b4192ee18
MD5 70c18b7abfbae5164e43c700703ef8cb
BLAKE2b-256 a6bbb9a41dc407e3f07cfc40cfc828473c451047a441491aa6164f5b53b83447

See more details on using hashes here.

File details

Details for the file upoints-0.12.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for upoints-0.12.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9b3ddf4c9b3f6990ed6348befc59e0aa6165cc14c573f8d7c1a09897757e0406
MD5 da166e2ada5bfe48062984022c2fb5ba
BLAKE2b-256 d7e747f7873b28ce43655c06aaa6ea689f542a5a129d593638f664903ce51213

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page