pyegt.utils
- pyegt.utils.get_ngs_json(ngs_url: str) dict
Use a given NGS API URL to get a response, and return the response if valid.
- Parameters:
ngs_url (str) – The NGS query URL
- Returns:
The returned json (if applicable)
- Return type:
json
- Raises:
AttributeError – if geoidHeight is not in returned json
ConnectionError – if no NGS JSON is returned in 3 tries
- pyegt.utils.get_ngs_url(lat: float, lon: float, ngs_model: int) str
Construct the API URL that will be used to query the NGS service.
- Parameters:
lat (float) – Decimal latitude
lon (float) – Decimal longitude
ngs_model (str) – The NGS geoid model to use for lookup (see list)
- Returns:
The query url to use in lookup
- Return type:
- pyegt.utils.get_vdatum_json(vdatum_url, region) dict
Use a given VDatum API URL to get a response, and return the response if valid.
- Parameters:
- Returns:
JSON response from VDatum API
- Return type:
- Raises:
AttributeError – if the returned JSON has an error indicating the set region is invalid
AttributeError – if the returned JSON has a generic error code
ConnectionError – if no VDatum JSON is returned in 3 tries
- pyegt.utils.get_vdatum_url(lat: float, lon: float, vdatum_model: str, region: str) str
Construct the API URL that will be used to query the VDatum service.
- pyegt.utils.model_search(vrs: str | None = None) str | Literal[None]
Get a model name from a search term containing that name.
Example:
>>> egm = "EGM2008 height" >>> model_search(vrs=egm) "EGM2008" >>> egmi = 3855 >>> model_search(vrs=egmi) "EGM2008" >>> navd88 = "NAVD88 (US Survey Feet)" >>> model_search(vrs=navd88) "NAVD88" >>> bad_name = "NAVD 88" >>> model_search(vrs=bad_name) None