Package pygeodesy :: Module utm
[frames] | no frames]

Module utm

Universal Transverse Mercator (UTM) class Utm and functions parseUTM and toUtm.

Pure Python implementation of UTM / WGS-84 conversion functions using an ellipsoidal earth model, transcribed from JavaScript originals by (C) Chris Veness 2011-2016 published under the same MIT Licence**, see http://www.movable-type.co.uk/scripts/latlong-utm-mgrs.html and http://www.movable-type.co.uk/scripts/geodesy/docs/module-utm.html.

The UTM system is a 2-dimensional cartesian coordinate system providing locations on the surface of the earth.

UTM is a set of 60 transverse Mercator projections, normally based on the WGS-84 ellipsoid. Within each zone, coordinates are represented as eastings and northings, measured in metres.

This method based on Karney 2011 'Transverse Mercator with an accuracy of a few nanometers', building on Krüger 1912 'Konforme Abbildung des Erdellipsoids in der Ebene'.

References http://arxiv.org/pdf/1002.1417v3.pdf, http://bib.gfz-potsdam.de/pub/digi/krueger2.pdf, http://henrik-seidel.gmxhome.de/gausskrueger.pdf and http://wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.


Version: 17.05.30

Classes
  Utm
Universal Transverse Mercator (UTM) coordinate.
Functions
 
parseUTM(strUTM, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)
Parses a string representing a UTM coordinate, consisting of zone, hemisphere, easting and northing.
 
toUtm(latlon, lon=None, datum=None, Utm=<class 'pygeodesy.utm.Utm'>)
Converts lat-/longitude point to a UTM coordinate.
Function Details

parseUTM(strUTM, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)

 

Parses a string representing a UTM coordinate, consisting of zone, hemisphere, easting and northing.

Parameters:
  • strUTM - A UTM coordinate (string).
  • datum - Datum to use (Datum).
Returns:
The UTM coordinate (Utm).
Raises:
  • ValueError - Invalid strUTM.

Example:

>>> u = parseUTM('31 N 448251 5411932')
>>> u.toStr2()  # [Z:31, H:N, E:448251, N:5411932]
>>> u = parseUTM('31 N 448251.8 5411932.7')
>>> u.toStr()  # 31 N 448252 5411933

toUtm(latlon, lon=None, datum=None, Utm=<class 'pygeodesy.utm.Utm'>)

 

Converts lat-/longitude point to a UTM coordinate.

Parameters:
  • latlon - Latitude (degrees) or an (ellipsoidal) geodetic LatLon point.
  • lon - Longitude (degrees or None).
  • datum - Datum for this UTM coordinate, overriding latlon's datum (Datum).
  • Utm - Utm class for the UTM coordinate (Utm).
Returns:
The UTM coordinate (Utm).
Raises:
  • TypeError - If latlon is not ellipsoidal.
  • ValueError - If lon value is missing, if latlon is not scalar or latlon is outside the valid UTM bands.

Note: Implements Karney’s method, using 6-th order Krüger series, giving results accurate to 5 nm for distances up to 3900 km from the central meridian.

Example:

>>> p = LatLon(48.8582, 2.2945)  # 31 N 448251.8 5411932.7
>>> u = toUtm(p)  # 31 N 448252 5411933
>>> p = LatLon(13.4125, 103.8667) # 48 N 377302.4 1483034.8
>>> u = toUtm(p)  # 48 N 377302 1483035