model.util.geometry¶
Attributes¶
Functions¶
|
Get altitude information for a given latitude and longitude from an OpenElevation server. |
|
Get altitude information for a given latitude and longitude from the Google Maps Elevation API. |
|
Get altitude information for a given latitude and longitude. |
Check whether the geometry types of Station, Route and AssocRouteStation have Z coordinates. |
Module Contents¶
- model.util.geometry.cache_dir¶
- model.util.geometry.cache_file¶
- model.util.geometry.store¶
- model.util.geometry.HTTP_TIMEOUT_SECONDS = 10¶
- model.util.geometry.get_altitude_openelevation(latlon)¶
Get altitude information for a given latitude and longitude from an OpenElevation server.
Requires the
OPENELEVATION_URLenvironment variable to be set.- Parameters:
latlon (Tuple[float, float])
- Return type:
float
- model.util.geometry.get_altitude_google(latlon)¶
Get altitude information for a given latitude and longitude from the Google Maps Elevation API.
Requires the
GOOGLE_MAPS_API_KEYenvironment variable to be set.- Parameters:
latlon (Tuple[float, float])
- Return type:
float
- model.util.geometry.get_altitude(latlon)¶
Get altitude information for a given latitude and longitude.
Tries OpenElevation first, then falls back to Google Maps. Results are cached on disk (rounded to 4 decimal places, ~11m resolution) via
kv_cache. SetELEVATION_DUMMY_MODE=Trueto return a constant dummy altitude.- Parameters:
latlon (Tuple[float, float])
- Return type:
float
- model.util.geometry.geometry_has_z()¶
Check whether the geometry types of Station, Route and AssocRouteStation have Z coordinates.
- Returns:
True if they have Z coordinates, False otherwise
- Return type:
bool