mt_metadata.utils.location_helpers
Functions
|
Convert position float to a string in the format of DD:MM:SS.ms |
|
Convert a position string in the format of DD:MM:SS to decimal degrees |
|
Validate position value (latitude or longitude) and convert to float. |
Module Contents
- mt_metadata.utils.location_helpers.convert_position_float2str(position)
Convert position float to a string in the format of DD:MM:SS.ms
- Parameters:
position (float | int) – decimal degrees of latitude or longitude
- Returns:
latitude or longitude in format of DD:MM:SS.ms
- Return type:
str
- mt_metadata.utils.location_helpers.convert_position_str2float(position_str)
Convert a position string in the format of DD:MM:SS to decimal degrees
- Parameters:
position (float) – latitude or longitude om DD:MM:SS.ms
position_str (str) – latitude or longitude om DD:MM:SS.ms
- Returns:
latitude or longitude as a float
- Returns:
latitude or longitude as a float
- Return type:
float
- Raises:
ValueError – If position string cannot be converted to a float or if the format is incorrect.
- mt_metadata.utils.location_helpers.validate_position(value, position_type)
Validate position value (latitude or longitude) and convert to float.
- Parameters:
value (str | float) – The position value to validate and convert.
position_type (str) – The type of position (‘latitude’ or ‘longitude’).
- Returns:
The validated and converted position value.
- Return type:
float
- Raises:
ValueError – If the value is not a valid latitude or longitude.