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

# Module gars

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

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

Version: 19.10.12

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

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. |

Function Details

### decode3(garef, center=True) |
Decode a `garef` to lat-, longitude and precision. Parameters: `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. Parameters: `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. Parameters: `res` - The required resolution (`degrees`). Returns: The Garef precision (`int` 0..2). See Also: Function gars.encode for more `precision` details.

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