Skip to main content

Bidirectional UTM-WGS84 converter for python

Project description

https://travis-ci.org/Turbo87/utm.png

Bidirectional UTM-WGS84 converter for python

Usage

import utm

Convert a (latitude, longitude) tuple into an UTM coordinate:

utm.from_latlon(51.2, 7.5)
>>> (395201.3103811303, 5673135.241182375, 32, 'U')

The syntax is utm.from_latlon(LATITUDE, LONGITUDE).

The return has the form (EASTING, NORTHING, ZONE NUMBER, ZONE LETTER).

Convert an UTM coordinate into a (latitude, longitude) tuple:

utm.to_latlon(340000, 5710000, 32, 'U')
>>> (51.51852098408468, 6.693872395145327)

The syntax is utm.to_latlon(EASTING, NORTHING, ZONE NUMBER, ZONE LETTER).

The return has the form (LATITUDE, LONGITUDE).

Since the zone letter is not strictly needed for the conversion you may also the northern parameter instead, which is a named parameter and can be set to either True or False. Have a look at the unit tests to see how it can be used.

The UTM coordinate system is explained on this Wikipedia page.

Speed

The library has been compared to the more generic pyproj library by running the unit test suite through pyproj instead of utm. These are the results:

  • with pyproj (without projection cache): 4.0 - 4.5 sec

  • with pyproj (with projection cache): 0.9 - 1.0 sec

  • with utm: 0.4 - 0.5 sec

Development

Create a new virtualenv and install the library via pip install -e .. After that install the pytest package via pip install pytest and run the unit test suite by calling py.test.

Authors

License

Copyright (C) 2012 Tobias Bieniek <Tobias.Bieniek@gmx.de>

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.

Project details


Download files

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

Source Distribution

utm-0.3.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utm-0.3.1.macosx-10.9-x86_64.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file utm-0.3.1.tar.gz.

File metadata

  • Download URL: utm-0.3.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for utm-0.3.1.tar.gz
Algorithm Hash digest
SHA256 509c92fd595809d43ed00b2f162f9532e620ed78d9af4ac5b5b8267e06a75a11
MD5 afcb37bad303cb7c1c5e283809849646
BLAKE2b-256 c0ba683ce0cff2e47b3f1726728dbbeea010bceb324fd2e88e28d714d2b1c445

See more details on using hashes here.

File details

Details for the file utm-0.3.1.macosx-10.9-x86_64.tar.gz.

File metadata

File hashes

Hashes for utm-0.3.1.macosx-10.9-x86_64.tar.gz
Algorithm Hash digest
SHA256 688263f4c8698e20b125c1b1f10dc253c0b517e0cc921acb91fc5aa41f3daca2
MD5 87bc184fb062e669ad9f877771042bac
BLAKE2b-256 d3396222a8164322565a98dac3fe2d08c0ad9a20b21c9d3b565446a5b7ad048e

See more details on using hashes here.

Supported by

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