Package pygeodesy :: Module ktm :: Class KTransverseMercator
[frames] | no frames]

Class KTransverseMercator

  object --+        
           |        
named._Named --+    
               |    
named._NamedBase --+
                   |
                  KTransverseMercator

Karney's C++ class TransverseMercator transcoded to pure Python, following is a partial copy of Karney's documentation.

Transverse Mercator projection based on Krüger's method which evaluates the projection and its inverse in terms of a series.

There's a singularity in the projection at phi = 0, lam - lam0 = +/- (1 - e) 90, about +/- 82.6 degrees for WGS84, where e is the eccentricity. Beyond this point, the series ceases to converge and the results from this method will be garbage. To be on the safe side, don't use this method if the angular distance from the central meridian exceeds (1 - 2e) x 90, about 75 degrees for the WGS84 ellipsoid.

Class ExactTransverseMercator is an alternative implementation of the projection using exact formulas which yield accurate (to 8 nm) results over the entire ellipsoid.

The ellipsoid parameters and the central scale are set in the constructor. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 keyword argument of the KTransverseMercator.forward and KTransverseMercator.reverse methods. The latitude of origin is taken to be the equator. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin. However these are can be simply included by the calling function.

The KTransverseMercator.forward and KTransverseMercator.reverse methods also return the meridian convergence gamma and scale k. The meridian convergence is the bearing of grid North, the y axis, measured clockwise from true North.

Instance Methods
 
__init__(self, a_earth=Ellipsoid(name='WGS84', a=6378137, b=6356752.31424518, f_=298...., f=None, lon0=0, k0=0.9996, name='', raiser=False, **TMorder)
New KTransverseMercator.
 
forward(self, lat, lon, lon0=None, name='')
Forward projection, from geographic to transverse Mercator.
 
reset(self, lat0, lon0)
Set the central parallel and meridian.
 
reverse(self, x, y, lon0=None, name='')
Reverse projection, from transverse Mercator to geographic.
 
toStr(self, **kwds)
Return a str representation.

Inherited from named._NamedBase: __repr__, __str__, others, toRepr

Inherited from named._Named: __imatmul__, __matmul__, __rmatmul__, attrs, classof, copy, dup, methodname, rename, toStr2

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties
  datum
Get this rhumb's datum (Datum).
  ellipsoid
Get the ellipsoid (Ellipsoid).
  equatoradius
Get the ellipsoid's equatorial radius, semi-axis (meter).
  a
Get the ellipsoid's equatorial radius, semi-axis (meter).
  flattening
Get the ellipsoid's flattening (scalar).
  f
Get the ellipsoid's flattening (scalar).
  k0
Class property with retrievable name.
  lon0
Class property with retrievable name.
  raiser
Class property with retrievable name.
  TMorder
Get the Transverse Mercator order (int, 4, 5, 6, 7 or 8).

Inherited from named._Named: classname, classnaming, iteration, name, named, named2, named3, named4, sizeof

Inherited from object: __class__

Method Details

__init__ (self, a_earth=Ellipsoid(name='WGS84', a=6378137, b=6356752.31424518, f_=298...., f=None, lon0=0, k0=0.9996, name='', raiser=False, **TMorder)
(Constructor)

 

New KTransverseMercator.

Arguments:
  • a_earth - This rhumb's earth (Ellipsoid, Ellipsoid2, a_f2Tuple, Datum, 2-tuple (a, f)) or the equatorial radius (scalar, meter).
  • f - The ellipsoid's flattening (scalar), iff a_earth is a scalar, ignored otherwise.
  • lon0 - The central meridian (degrees180).
  • k0 - Central scale factor (scalar).
  • name - Optional name (str).
  • raiser - If True, throw a KTMError for forward singularities (bool).
  • TMorder - Keyword argument TMorder, see property TMorder.
Raises:
  • KTMError - Invalid a_earth, f or TMorder.
Overrides: object.__init__

forward (self, lat, lon, lon0=None, name='')

 

Forward projection, from geographic to transverse Mercator.

Arguments:
  • lat - Latitude of point (degrees90).
  • lon - Longitude of point (degrees180).
  • lon0 - Central meridian of the projection (degrees180).
  • name - Optional name (str).
Returns:
Forward4Tuple(easting, northing, gamma, scale) with easting and northing in meter, unfalsed, the meridian convergence gamma at point in degrees180 and the scale of projection at point scalar. Any value may be NAN, NINF or INF for singularities.
Raises:
  • KTMError - For singularities, iff property raiser is True.

reset (self, lat0, lon0)

 

Set the central parallel and meridian.

Arguments:
  • lat0 - Latitude of the central parallel (degrees90).
  • lon0 - Longitude of the central parallel (degrees180).
Returns:
2-Tuple (lat0, lon0) of the previous central parallel and meridian.
Raises:

reverse (self, x, y, lon0=None, name='')

 

Reverse projection, from transverse Mercator to geographic.

Arguments:
  • x - Easting of point (meter).
  • y - Northing of point (meter).
  • lon0 - Central meridian of the projection (degrees180).
Returns:
Reverse4Tuple(lat, lon, gamma, scale) with lat- and longitude in degrees, unfalsed.

toStr (self, **kwds)

 

Return a str representation.

Arguments:
  • kwds - Optional, overriding keyword arguments.
Overrides: named._Named.toStr

Property Details

datum

Get this rhumb's datum (Datum).

Get method:
datum(self) - Get this rhumb's datum (Datum).
Set method:
datum(self, datum) - Set this rhumb's datum (Datum).

ellipsoid

Get the ellipsoid (Ellipsoid).

Get method:
ellipsoid(self) - Get the ellipsoid (Ellipsoid).
Set method:
ellipsoid(self, a_earth_f) - Set this rhumb's ellipsoid (Ellipsoid, Ellipsoid2, Datum, a_f2Tuple or 2-tuple (a, f)).
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

equatoradius

Get the ellipsoid's equatorial radius, semi-axis (meter).

Get method:
equatoradius(self) - Get the ellipsoid's equatorial radius, semi-axis (meter).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

a

Get the ellipsoid's equatorial radius, semi-axis (meter).

Get method:
equatoradius(self) - Get the ellipsoid's equatorial radius, semi-axis (meter).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

flattening

Get the ellipsoid's flattening (scalar).

Get method:
flattening(self) - Get the ellipsoid's flattening (scalar).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

f

Get the ellipsoid's flattening (scalar).

Get method:
flattening(self) - Get the ellipsoid's flattening (scalar).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

k0

Class property with retrievable name.

Get method:
k0(self) - Get the central scale factor (float), aka scale0.
Set method:
k0(self, k0) - Set the central scale factor (float), aka scale0.

lon0

Class property with retrievable name.

Get method:
lon0(self) - Get the central meridian (degrees180).
Set method:
lon0(self, lon0) - Set the central meridian (degrees180).

raiser

Class property with retrievable name.

Get method:
raiser(self) - Get the error setting (bool).
Set method:
raiser(self, raiser) - Set the error setting (bool), to True to throw a KTMError for forward singularities.

TMorder

Get the Transverse Mercator order (int, 4, 5, 6, 7 or 8).

Get method:
TMorder(self) - Get the Transverse Mercator order (int, 4, 5, 6, 7 or 8).
Set method:
TMorder(self, order) - Set the Transverse Mercator order (int, 4, 5, 6, 7 or 8).
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.