suboptimumg.track.gps#
- suboptimumg.track.gps.gps_calculate_distance(coords)[source]#
Returns the distance between trackpoints using the haversine formula.
- Parameters:
coords (CoordinateListInput) – GPS coordinates to calculate distances for
- Returns:
Index i is the distance from the i - 1 to the i-th coordinate
- Return type:
npt.NDArray[np.float64]
- suboptimumg.track.gps.gps_interpolate(coords, smooth=0)[source]#
Cleans GPS data, then interpolates to get a new set of coordinates with at a constant distance interval
- Parameters:
coords (CoordinateListInput) – Specifies the original coordinates, as well as the constant distance interval to interpolate at through the distance_step field
smooth (float, optional) – Smoothing parameter for spline interpolation (default: 0)
- Returns:
(coords_new, spline, cumulative_dist_new) - A CoordinateListInput object with the same GPS data but at constant distance intervals, the underlying scipy spline object, and a cumulative distance array based on the new coordinates
- Return type:
Tuple[CoordinateListInput, Any, npt.NDArray[np.float64]]
- suboptimumg.track.gps.gps_remove_duplicates(coords)[source]#
De-duplicate GPS coordinates by removing coordinates with distance of 0.0 between them
- Parameters:
coords (CoordinateListInput) – GPS coordinates to de-duplicate
- Returns:
De-duplicated GPS coordinates
- Return type:
- suboptimumg.track.gps.gps_to_cartesian(coords, origin_offset=True)[source]#
Converts GPS coordinates (lat/lon) to Cartesian coordinates (x, y) in meters. Uses Web Mercator projection (EPSG:3857).
- Parameters:
coords (CoordinateListInput) – GPS coordinates to convert
origin_offset (bool, optional) – If True, offsets coordinates so the first point is at (0, 0) (default: True)
- Returns:
(x_m, y_m) - Arrays of x and y coordinates in meters
- Return type:
Tuple[NDArray[float64], NDArray[float64]]