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

# Module wgrs

Classes Georef and WGRSError and several functions to encode, decode and inspect World Geographic Reference System (WGRS) references.

Transcribed from C++ class Georef by Charles Karney, but with modified `precision` and extended with `height` and `radius`. See also World Geographic Reference System.

Version: 19.07.12

Classes
| WGRSError World Geographic Reference System (WGRS) encode, decode or other Georef issue.
| Georef Georef class, a `_NamedStr`.

Functions
decode3(georef, center=True) Decode a `georef` to lat-, longitude and precision. |
decode5(georef, center=True) Decode a `georef` to lat-, longitude, precision, height and radius. |
encode(lat, lon, precision=3, height=None, radius=None) Encode a lat-/longitude as a `georef` of the given precision. |
precision(res) Determine the Georef precision to meet a required (geographic) resolution. |
resolution(prec) Determine the (geographic) resolution of a given Georef precision. |

Function Details

### decode3(georef, center=True) |
Decode a `georef` to lat-, longitude and precision. Parameters: `georef` - To be decoded (Georef or `str`). `center` - If `True` the center, otherwise the south-west, lower-left corner (`bool`). Returns: A LatLonPrec3Tuple`(lat, lon, precision)`. Raises: `WGRSError` - Invalid `georef`, INValid, non-alphanumeric or odd length `georef`.

### decode5(georef, center=True) |
Decode a `georef` to lat-, longitude, precision, height and radius. Parameters: `georef` - To be decoded (Georef or `str`). `center` - If `True` the center, otherwise the south-west, lower-left corner (`bool`). Returns: A LatLonPrec5Tuple`(lat, lon, precision, height, radius)` where `height` and/or `radius` are `None` if missing. Raises: `WGRSError` - Invalid `georef`, INValid, non-alphanumeric or odd length `georef`.

### encode(lat, lon, precision=3, height=None, radius=None) |
Encode a lat-/longitude as a `georef` of the given precision. Parameters: `lat` - Latitude (`degrees`). `lon` - Longitude (`degrees`). `precision` - Optional, the desired `georef` resolution and length (`int` 0..11). `height` - Optional, height in `meter`, see Designation of area. `radius` - Optional, radius in `meter`, see Designation of area. Returns: The `georef` (`str`). Raises: `RangeError` - Invalid `lat` or `lon`. `WGRSError` - Invalid `precision`, `height` or `radius`. Note: The `precision` value differs from Georef. The `georef` length is 2 * (precision + 1) and the `georef` resolution is 15° for `precision` 0, 1° for 1, 1′ for 2, 0.1′ for 3, 0.01′ for 4, ... 10**(2 - precision).

### precision(res) |
Determine the Georef precision to meet a required (geographic) resolution. Parameters: `res` - The required resolution (`degrees`). Returns: The Georef precision (`int` 0..11). See Also: Function wgrs.encode for more `precision` details.

### resolution(prec) |
Determine the (geographic) resolution of a given Georef precision. Parameters: `prec` - The given precision (`int`). Returns: The (geographic) resolution (`degrees`). See Also: Function wgrs.encode for more `precision` details.