Package pygeodesy :: Module webmercator :: Class Wm |
[frames] | no frames]

# Class Wm

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

Web Mercator (WM) coordinate.

Instance Methods
__init__(self, x, y, radius=6378137.0, name='') New Wm Web Mercator (WM) coordinate. |
latlon2(self, datum=None) Convert this WM coordinate to a lat- and longitude. |
parse(self, strWM, name='') Parse a string to a similar Wm instance. |
parseWM(self, strWM, name='') DEPRECATED, use method Wm.parse. |
to2ll(self, datum=None) DEPRECATED, use method `latlon2`. |
toLatLon(self, LatLon, datum=None, **LatLon_kwds) Convert this WM coordinate to a geodetic point. |
toRepr(self, prec=3, fmt='[%s]', sep=', ', radius=False, **unused) Return a string representation of this WM coordinate. |
toStr2(self, prec=3, fmt='[%s]', sep=', ', radius=False, **unused) DEPRECATED, use method Wm.toRepr. |
toStr(self, prec=3, sep=' ', radius=False, **unused) Return a string representation of this WM coordinate. |
Inherited from `named._NamedBase`: `__repr__`, `__str__`, `others` Inherited from `named._Named`: `_DOT_`, `attrs`, `classof`, `copy` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| latlon Get the lat- and longitude (LatLon2Tuple`(lat, lon)`).
| philam Get the lat- and longitude ((PhiLam2Tuple`(phi, lam)`).
| radius Get the earth radius (`meter`).
| x Get the easting (`meter`).
| y Get the northing (`meter`).
Inherited from `named._Named`: `classname`, `classnaming`, `name`, `named`, `named2`, `named3`, `named4` Inherited from `object`: `__class__`

Method Details

### __init__ (self, x, y, radius=6378137.0, name='') (Constructor) |
New Wm Web Mercator (WM) coordinate. Arguments: `x` - Easting from central meridian (`meter`). `y` - Northing from equator (`meter`). `radius` - Optional earth radius (`meter`). `name` - Optional name (`str`). Raises: `WebMercatorError` - Invalid `x`, `y` or `radius`. Overrides: object.__init__ Example:
    >>> import pygeodesy
    >>> w = pygeodesy.Wm(448251, 5411932)

### latlon2 (self, datum=None) |
Convert this WM coordinate to a lat- and longitude. Arguments: `datum` - Optional, ellipsoidal datum (Datum, Ellipsoid, Ellipsoid2 or a_f2Tuple) or `None`. Returns: A LatLon2Tuple`(lat, lon)`. Raises: `TypeError` - Invalid or non-ellipsoidal `datum`. See Also: Method `toLatLon`.

### parse (self, strWM, name='') |
Parse a string to a similar Wm instance. Arguments: `strWM` - The WM coordinate (`str`), see function parseWM. `name` - Optional instance name (`str`), overriding this name. Returns: The similar instance (Wm). Raises: `WebMercatorError` - Invalid `strWM`.

### to2ll (self, datum=None) |
DEPRECATED, use method `latlon2`. Returns: A LatLon2Tuple`(lat, lon)`.

### toLatLon (self, LatLon, datum=None, **LatLon_kwds) |
Convert this WM coordinate to a geodetic point. Arguments: `LatLon` - Ellipsoidal class to return the geodetic point (`LatLon`). `datum` - Optional datum for ellipsoidal or `None` for spherical `LatLon` (`Datum`). `LatLon_kwds` - Optional, additional `LatLon` keyword arguments. Returns: Point of this WM coordinate (`LatLon`). Raises: `TypeError` - If `LatLon` and `datum` are incompatible or if `datum` is invalid or not ellipsoidal. Example:
    >>> w = Wm(448251.795, 5411932.678)
    >>> from pygeodesy import sphericalTrigonometry as sT
    >>> ll = w.toLatLon(sT.LatLon)  # 43°39′11.58″N, 004°01′36.17″E

### toRepr (self, prec=3, fmt='[%s]', sep=', ', radius=False, **unused) |
Return a string representation of this WM coordinate. Arguments: `prec` - Optional number of decimals, unstripped (`int`). `fmt` - Optional, enclosing backets format (`str`). `sep` - Optional separator between name:value pairs (`str`). `radius` - Optionally, include radius (`bool` or `scalar`). Returns: This WM as "[x:meter, y:meter]" (`str`) plus ", radius:meter]" if `radius` is `True` or `scalar`. Raises: `WebMercatorError` - Invalid `radius`. Overrides: named._Named.toRepr

### toStr2 (self, prec=3, fmt='[%s]', sep=', ', radius=False, **unused) |
DEPRECATED, use method Wm.toRepr. Arguments: `prec` - Optional number of decimals, unstripped (`int`). `fmt` - Optional, enclosing backets format (`str`). `sep` - Optional separator between name:value pairs (`str`). `radius` - Optionally, include radius (`bool` or `scalar`). Returns: This WM as "[x:meter, y:meter]" (`str`) plus ", radius:meter]" if `radius` is `True` or `scalar`. Raises: `WebMercatorError` - Invalid `radius`. Overrides: named._Named.toRepr

### toStr (self, prec=3, sep=' ', radius=False, **unused) |
Return a string representation of this WM coordinate. Arguments: `prec` - Optional number of decimals, unstripped (`int`). `sep` - Optional separator to join (`str`) or `None` to return an unjoined `tuple` of `str`s. `radius` - Optionally, include radius (`bool` or `scalar`). Returns: This WM as "meter meter" (`str`) plus " radius" if `radius` is `True` or `scalar`. Raises: `WebMercatorError` - Invalid `radius`. Overrides: named._Named.toStr Example:
    >>> w = Wm(448251, 5411932.0001)
    >>> w.toStr(4)  # 448251.0 5411932.0001
    >>> w.toStr(sep=', ')  # 448251, 5411932

Property Details

### latlon Get the lat- and longitude (LatLon2Tuple`(lat, lon)`). Get method: latlon(self) - Get the lat- and longitude (LatLon2Tuple`(lat, lon)`). Set method: _immutable(inst, value) - Throws an `AttributeError`, always.

### philam Get the lat- and longitude ((PhiLam2Tuple`(phi, lam)`). Get method: philam(self) - Get the lat- and longitude ((PhiLam2Tuple`(phi, lam)`). Set method: _immutable(inst, value) - Throws an `AttributeError`, always.

### radius Get the earth radius (`meter`). Get method: radius(self) - Get the earth radius (`meter`). Set method: _immutable(inst, value) - Throws an `AttributeError`, always.

### x Get the easting (`meter`). Get method: x(self) - Get the easting (`meter`). Set method: _immutable(inst, value) - Throws an `AttributeError`, always.

### y Get the northing (`meter`). Get method: y(self) - Get the northing (`meter`). Set method: _immutable(inst, value) - Throws an `AttributeError`, always.