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

# Class Wm

     object --+
              |
    bases.Named --+
                  |
        bases.Based --+
                      |
                     Wm

Web Mercator (WM) coordinate.

Instance Methods
__init__(self, x, y, radius=6378137.0, name=`'````'`) New Web Mercator (WM) coordinate. |
copy(self) Copy this Web Marcator coordinate. |
parseWM(self, strWM, name=`'````'`) Parse a string to a WM coordinate. |
to2ll(self, datum=None) Convert this WM coordinate to a geodetic lat- and longitude. |
toLatLon(self, LatLon, datum=None) Convert this WM coordinate to a geodetic point. |
toStr(self, prec=3, sep=`'``` `'`, radius=False) Return a string representation of this WM coordinate. |
toStr2(self, prec=3, fmt=`'``[%s]``'`, sep=`'``,` `'`, radius=False) Return a string representation of this WM coordinate. |
Inherited from `bases.Based`: `__repr__`, `__str__`, `classof`, `others` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| radius Get the earth radius (`meter`).
| x Get the easting (`meter`).
| y Get the northing (`meter`).
Inherited from `bases.Named`: `classname`, `classnaming`, `name` Inherited from `object`: `__class__`

Method Details

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

### copy(self) |
Copy this Web Marcator coordinate. Returns: The copy (Wm or subclass thereof). Overrides: bases.Named.copy

### parseWM(self, strWM, name=`'````'`) |
Parse a string to a WM coordinate. For more details, see function parseWM in this module webmercator.

### to2ll(self, datum=None) |
Convert this WM coordinate to a geodetic lat- and longitude. Parameters: `datum` - Optional datum (`Datum`). Returns: 2-Tuple (lat, lon) in (`degrees90`, `degrees180`). Raises: `TypeError` - Non-ellipsoidal datum. `ValueError` - Invalid radius.

### toLatLon(self, LatLon, datum=None) |
Convert this WM coordinate to a geodetic point. Parameters: `LatLon` - Ellipsoidal (sub-)class to use for the point (`LatLon`). `datum` - Optional datum for ellipsoidal or `None` for spherical LatLon (`Datum`). Returns: Point of this WM coordinate (LatLon). Raises: `TypeError` - If LatLon and datum are not compatible or if datum is not ellipsoidal. `ValueError` - Invalid radius. 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

### toStr(self, prec=3, sep=`'``` `'`, radius=False) |
Return a string representation of this WM coordinate. Parameters: `prec` - Optional number of decimals, unstripped (`int`). `sep` - Optional separator to join (`str`). `radius` - Optionally, include radius (`bool` or `scalar`). Returns: This WM as "meter meter" (`str`) plus " radius" if radius is `True` or `scalar`. Raises: `ValueError` - Invalid radius. Overrides: bases.Based.toStr Example:
    >>> w = Wm(448251, 5411932.0001)
    >>> w.toStr(4)  # 448251.0 5411932.0001
    >>> w.toStr(sep=', ')  # 448251, 5411932

### toStr2(self, prec=3, fmt=`'``[%s]``'`, sep=`'``,` `'`, radius=False) |
Return a string representation of this WM coordinate. Parameters: `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`. Overrides: bases.Based.toStr2

Property Details

### radius Get the earth radius (`meter`). Get Method: radius(self) - Get the earth radius (`meter`). Set Method: Read_Only(self, ignored) - Throws an `AttributeError`, always.

### x Get the easting (`meter`). Get Method: x(self) - Get the easting (`meter`). Set Method: Read_Only(self, ignored) - Throws an `AttributeError`, always.

### y Get the northing (`meter`). Get Method: y(self) - Get the northing (`meter`). Set Method: Read_Only(self, ignored) - Throws an `AttributeError`, always.