Coordinate conversion

When you start working with multiple datasets you'll inevitably end up with data in different coordinate systems and projections. You can convert back and forth between Universal Transverse Mercator (UTM) and latitude/longitude using a pure Python module called utm. You can install it using easy_install or pip from PyPI available at the following link:

https://pypi.python.org/pypi/utm

The utm module is straightforward to use. To convert from UTM to latitude and longitude, use the following commands:

>>> import utm
>>> y = 479747.0453210057
>>> x = 5377685.825323031
>>> zone = 32
>>> band = 'U'
>>> print(utm.to_latlon(y, x, zone, band))
>>> (48.55199390882121, 8.725555729071763)

The UTM zones are numbered horizontally. However, ...

Get Learning Geospatial Analysis with Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.