API Reference
- class fastgpx.Bounds(*args, **kwargs)
- __init__(self) None
- __init__(self, min: fastgpx.LatLong, max: fastgpx.LatLong) None
- __init__(self, min: tuple[float, float], max: tuple[float, float]) None
- __init__(self, min: tuple[float, float, float], max: tuple[float, float, float]) None
- add(self, location: fastgpx.LatLong) None
- add(self, bounds: fastgpx.Bounds) None
- is_empty(self) bool
- property max: fastgpx.LatLong | None
- max_bounds(self, bounds: fastgpx.Bounds) fastgpx.Bounds
- property max_latitude
Warning
Compatibility with
gpxpy.GPXBounds.max_latitude. Prefermax.latitudeinstead.max()
- property max_longitude
Warning
Compatibility with
gpxpy.GPXBounds.max_longitude. Prefermax.longitudeinstead.max()
- property min: fastgpx.LatLong | None
- class fastgpx.Gpx(*args, **kwargs)
Represent
<gpx>data in GPX files.- __init__(self) None
- bounds(self) fastgpx.Bounds
- get_bounds(self) fastgpx.Bounds
Warning
Compatibility with
gpxpy.GPX.get_bounds. Preferbounds()instead.
- get_time_bounds(self) fastgpx.TimeBounds
Warning
Compatibility with
gpxpy.GPX.get_time_bounds. Prefertime_bounds()instead.
- length_2d(self) float
Distance in meters.
- length_3d(self) float
Distance in meters.
- property name: str | None
- time_bounds(self) fastgpx.TimeBounds
- property tracks: list[fastgpx.Track]
- class fastgpx.LatLong(*args, **kwargs)
Represent
<trkpt>data in GPX files.- __init__(self) None
- __init__(self, latitude: float, longitude: float, elevation: float = 0.0) None
- property elevation
The elevation of the point in meters.
- property latitude
The latitude of the point. Decimal degrees, WGS84 datum.
- property longitude
The longitude of the point. Decimal degrees, WGS84 datum.
- class fastgpx.Segment(*args, **kwargs)
Represent
<trkseg>data in GPX files.- __init__(self) None
- bounds(self) fastgpx.Bounds
- get_bounds(self) fastgpx.Bounds
Warning
Compatibility with
gpxpy.GPXTrackSegment.get_bounds. Preferbounds()instead.
- get_time_bounds(self) fastgpx.TimeBounds
Warning
Compatibility with
gpxpy.GPXTrackSegment.get_time_bounds. Prefertime_bounds()instead.
- length_2d(self) float
Distance in meters.
- length_3d(self) float
Distance in meters.
- property points: list[fastgpx.LatLong]
- time_bounds(self) fastgpx.TimeBounds
- class fastgpx.TimeBounds(*args, **kwargs)
- __init__(self) None
- __init__(self, start_time: datetime.datetime | datetime.date | datetime.time | None, end_time: datetime.datetime | datetime.date | datetime.time | None) None
- add(self, datetime: datetime.datetime | datetime.date | datetime.time) None
- add(self, timebounds: fastgpx.TimeBounds) None
- property end_time: datetime.datetime | None
- is_empty(self) bool
- is_range(self) bool
- property start_time: datetime.datetime | None
- class fastgpx.Track(*args, **kwargs)
Represent
<trk>data in GPX files.- __init__(self) None
- bounds(self) fastgpx.Bounds
- property comment: str | None
- property description: str | None
- get_bounds(self) fastgpx.Bounds
Warning
Compatibility with
gpxpy.GPXTrack.get_bounds. Preferbounds()instead.
- get_time_bounds(self) fastgpx.TimeBounds
Warning
Compatibility with
gpxpy.GPXTrack.get_time_bounds. Prefertime_bounds()instead.
- length_2d(self) float
Distance in meters.
- length_3d(self) float
Distance in meters.
- property name: str | None
- property number: int | None
- property segments: list[fastgpx.Segment]
- time_bounds(self) fastgpx.TimeBounds
- property type: str | None
- fastgpx.load(path: str | os.PathLike) fastgpx.Gpx
- fastgpx.parse(data: str) fastgpx.Gpx
geo module
Algorithms for geographic calculations.
- fastgpx.geo.haversine(latlong1: fastgpx.LatLong, latlong2: fastgpx.LatLong) float
Haversine distance returned in meters using
osmiumlogic.
- fastgpx.geo.haversine_distance(latitude_1: float, longitude_1: float, latitude_2: float, longitude_2: float) float
Warning
Signature compatibility with
gpxpy.geo.haversine_distance. Preferhaversine()instead.Important
While the signature matches
gpxpy, the implementation usesosmiumlogic which may lead to slightly different results.
polyline module
- fastgpx.polyline.decode(encoded: str, precision: fastgpx.polyline.Precision = Precision.Five) list[fastgpx.LatLong]
- fastgpx.polyline.decode(locations: str, precision: int = 5) list[fastgpx.LatLong]
- fastgpx.polyline.encode(locations: collections.abc.Sequence[fastgpx.LatLong], precision: fastgpx.polyline.Precision = Precision.Five) str
- fastgpx.polyline.encode(locations: collections.abc.Sequence[fastgpx.LatLong], precision: int = 5) str