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

# Module webmercator

Web Mercator (WM) projection.

Classes Wm and WebMercatorError and functions parseWM and toWm.

Pure Python implementation of a Web Mercator (aka Pseudo-Mercator) class and conversion functions for spherical and near-spherical earth models.

See Also: Google Maps / Bing Maps Spherical Mercator Projection, Geomatics Guidance Note 7, part 2 and Implementation Practice Web Mercator Map Projection.

Version: 23.06.12

Classes
| EasNorRadius3Tuple 3-Tuple `(easting, northing, radius)`, all in `meter`.
| WebMercatorError Web Mercator (WM) parser or Wm issue.
| Wm Web Mercator (WM) coordinate.

Functions
parseWM(strWM, radius=6378137.0, Wm=<class 'pygeodesy.webmercator.Wm'>, name='') Parse a string `"e n [r]"` representing a WM coordinate, consisting of easting, northing and an optional radius. |
toWm(latlon, lon=None, earth=6378137.0, Wm=<class 'pygeodesy.webmercator.Wm'>, name='', **Wm_kwds) Convert a lat-/longitude point to a WM coordinate. |

Variables
| __all__ = `_ALL_LAZY.webmercator`

Function Details

### parseWM (strWM, radius=6378137.0, Wm=<class 'pygeodesy.webmercator.Wm'>, name='') |
Parse a string `"e n [r]"` representing a WM coordinate, consisting of easting, northing and an optional radius. Arguments: `strWM` - A WM coordinate (`str`). `radius` - Optional earth radius (`meter`), needed in case `strWM` doesn't include `r`. `Wm` - Optional class to return the WM coordinate (Wm) or `None`. `name` - Optional name (`str`). Returns: The WM coordinate (`Wm`) or an EasNorRadius3Tuple`(easting, northing, radius)` if `Wm` is `None`. Raises: `WebMercatorError` - Invalid `strWM`.

### toWm (latlon, lon=None, earth=6378137.0, Wm=<class 'pygeodesy.webmercator.Wm'>, name='', **Wm_kwds) |
Convert a lat-/longitude point to a WM coordinate. Arguments: `latlon` - Latitude (`degrees`) or an (ellipsoidal or spherical) geodetic `LatLon` point. `lon` - Optional longitude (`degrees` or `None`). `earth` - Earth radius (`meter`), datum or ellipsoid (Datum, a_f2Tuple, Ellipsoid or Ellipsoid2), overridden by `latlon`'s datum if present. `Wm` - Optional class to return the WM coordinate (Wm) or `None`. `name` - Optional name (`str`). `Wm_kwds` - Optional, additional `Wm` keyword arguments, ignored if `Wm is None`. Returns: The WM coordinate (`Wm`) or if `Wm` is `None` an EasNorRadius3Tuple`(easting, northing, radius)`. Raises: `ValueError` - If `lon` value is missing, if `latlon` is not scalar, if `latlon` is beyond the valid WM range and pygeodesy.rangerrors is set to `True` or if `earth` is invalid.