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

str

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:
  • vdatum_url (str) – The VDatum query URL

  • region (str) – The region to search

Returns:

JSON response from VDatum API

Return type:

dict

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.

Parameters:
  • lat (float) – Decimal latitude

  • lon (float) – Decimal longitude

  • vdatum_model (str) – The VDatum geoid, tidal, or geopotential model to use for lookup (see list at pyegt.defs.MODEL_LIST)

  • region (str) – The region to search

Returns:

The VDatum query URL

Return type:

str

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
Parameters:

vrs (str) – The search term containing the model name

Returns:

A verified model name or None if none is found

Return type:

str or None


Back to top ↑