activereader.gpx module
.gpx file reader architecture.
See also
- GPX schema
Official documentation for GPX elements and file structure.
- Garmin’s GPX trackpoint extension schema
XML file describing the schema for Garmin’s additional GPX trackpoint elements.
|
Represents an entire .gpx file object. |
|
An ordered list of trackpoints describing a path. |
|
Holds a list of trackpoints which are logically connected in order. |
|
Represents a single data sample corresponding to a point in time. |
- class activereader.gpx.Gpx(lxml_elem)
Bases:
ActivityElement
Represents an entire .gpx file object.
- TAG = 'gpx'
XML tag name of the element.
If an instance of the class is initialized from a
lxml.etree._Element
with any other tag name, a TypeError will be raised.
- classmethod from_file(file_obj)
Initialize a Gpx element from a file-like object.
- Parameters
file_obj (str, bytes, io.StringIO, io.BytesIO) – File-like object. If str, either filename or a string representation of XML object. If str or StringIO, the encoding should not be declared within the string.
- Returns
An instance initialized with the
_Element
that was read in.- Return type
- property start_time
Timestamp at start of recording.
See also
- Type
datetime.datetime
- property trackpoints
All element descendents with tag name “trkpt”.
- Type
list
ofTrackpoint
- property routepoints
All element descendents with tag name “rtept”.
- Type
list
ofRoutepoint
- class activereader.gpx.Track(lxml_elem)
Bases:
ActivityElement
An ordered list of trackpoints describing a path.
- TAG = 'trk'
XML tag name of the element.
If an instance of the class is initialized from a
lxml.etree._Element
with any other tag name, a TypeError will be raised.
- property trackpoints
All element descendents with tag name “trkpt”.
- Type
list
ofTrackpoint
- class activereader.gpx.Segment(lxml_elem)
Bases:
ActivityElement
Holds a list of trackpoints which are logically connected in order.
To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.
- TAG = 'trkseg'
XML tag name of the element.
If an instance of the class is initialized from a
lxml.etree._Element
with any other tag name, a TypeError will be raised.
- property trackpoints
All element descendents with tag name “trkpt”.
- Type
list
ofTrackpoint
- class activereader.gpx.Trackpoint(lxml_elem)
Bases:
ActivityElement
Represents a single data sample corresponding to a point in time.
The most granular of data contained in the file.
- TAG = 'trkpt'
XML tag name of the element.
If an instance of the class is initialized from a
lxml.etree._Element
with any other tag name, a TypeError will be raised.
- property time
Timestamp when trackpoint was recorded.
See also
- Type
datetime.datetime
- property altitude_m
Elevation of ground surface in meters above sea level.
- Type
float
- property hr
Heart rate.
- Type
int
- property lat
Latitude in degrees N (-90 to 90).
- Type
float
- property lon
Longitude in degrees E (-180 to 180).
- Type
float