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

# Module gars

Global Area Reference System (GARS) en-/decoding.

Classes Garef and GARSError and several functions to encode, decode and inspect Global Area Reference System (GARS) references.

Transcoded from C++ class GARS by Charles Karney. See also Global Area Reference System and NGA (GARS).

Version: 22.09.29

Classes
| GARSError Global Area Reference System (GARS) encode, decode or other Garef issue.
| Garef Garef class, a named `str`.

Functions
decode3(garef, center=True) Decode a `garef` to lat-, longitude and precision. |
encode(lat, lon, precision=1) Encode a lat-/longitude as a `garef` of the given precision. |
precision(res) Determine the Garef precision to meet a required (geographic) resolution. |
resolution(prec) Determine the (geographic) resolution of a given Garef precision. |

Variables
| __all__ = `_ALL_LAZY.gars`

Function Details

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

### encode (lat, lon, precision=1) |
Encode a lat-/longitude as a `garef` of the given precision. Arguments: `lat` - Latitude (`degrees`). `lon` - Longitude (`degrees`). `precision` - Optional, the desired `garef` resolution and length (`int` 0..2). Returns: The `garef` (`str`). Raises: `RangeError` - Invalid `lat` or `lon`. `GARSError` - Invalid `precision`. Note: The `garef` length is precision + 5 and the `garef` resolution is 30′ for `precision` 0, 15′ for 1 and 5′ for 2, respectively.

### precision (res) |
Determine the Garef precision to meet a required (geographic) resolution. Arguments: `res` - The required resolution (`degrees`). Returns: The Garef precision (`int` 0..2). Raises: `ValueError` - Invalid `res`. See Also: Function gars.encode for more `precision` details.

### resolution (prec) |
Determine the (geographic) resolution of a given Garef precision. Arguments: `prec` - The given precision (`int`). Returns: The (geographic) resolution (`degrees`). Raises: `GARSError` - Invalid `prec`. See Also: Function gars.encode for more `precision` details.