gpx
¶
gpx - Imports GPS eXchange format data files.
-
class
upoints.gpx.
Routepoint
(latitude, longitude, name=None, description=None, elevation=None, time=None)[source]¶ Bases:
upoints.gpx._GpxElem
Class for representing a
rtepoint
element from GPX data files.New in version 0.10.0.
See also
_GpxElem
Initialise a new
_GpxElem
object.Parameters:
-
class
upoints.gpx.
Routepoints
(gpx_file=None, metadata=None)[source]¶ Bases:
upoints.gpx._SegWrap
Class for representing a group of
Routepoint
objects.New in version 0.10.0.
Initialise a new
_SegWrap
object.-
export_gpx_file
()[source]¶ Generate GPX element tree from
Routepoints
.Returns: - GPX element tree depicting
Routepoints
- objects
Return type: etree.ElementTree - GPX element tree depicting
-
import_locations
(gpx_file)[source]¶ Import GPX data files.
import_locations()
returns a series of lists representing track segments withRoutepoint
objects as contents.It expects data files in GPX format, as specified in GPX 1.1 Schema Documentation, which is XML such as:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <gpx version="1.1" creator="upoints/0.12.2" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> <rte> <rtept lat="52.015" lon="-0.221"> <name>Home</name> <desc>My place</desc> </rtept> <rtept lat="52.167" lon="0.390"> <name>MSR</name> <desc>Microsoft Research, Cambridge</desc> </rtept> </rte> </gpx>
The reader uses the
ElementTree
module, so should be very fast when importing data. The above file processed byimport_locations()
will return the followinglist
object:[[Routepoint(52.015, -0.221, "Home", "My place"), Routepoint(52.167, 0.390, "MSR", "Microsoft Research, Cambridge")], ]
Parameters: gpx_file (iter) – GPX data to read Returns: Locations with optional comments Return type: list
-
-
class
upoints.gpx.
Trackpoint
(latitude, longitude, name=None, description=None, elevation=None, time=None)[source]¶ Bases:
upoints.gpx._GpxElem
Class for representing a trackpoint element from GPX data files.
New in version 0.10.0.
See also
_GpxElem
Initialise a new
_GpxElem
object.Parameters:
-
class
upoints.gpx.
Trackpoints
(gpx_file=None, metadata=None)[source]¶ Bases:
upoints.gpx._SegWrap
Class for representing a group of
Trackpoint
objects.New in version 0.10.0.
Initialise a new
_SegWrap
object.-
export_gpx_file
()[source]¶ Generate GPX element tree from
Trackpoints
.Returns: - GPX element tree depicting
Trackpoints
- objects
Return type: etree.ElementTree - GPX element tree depicting
-
import_locations
(gpx_file)[source]¶ Import GPX data files.
import_locations()
returns a series of lists representing track segments withTrackpoint
objects as contents.It expects data files in GPX format, as specified in GPX 1.1 Schema Documentation, which is XML such as:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <gpx version="1.1" creator="upoints/0.12.2" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> <trk> <trkseg> <trkpt lat="52.015" lon="-0.221"> <name>Home</name> <desc>My place</desc> </trkpt> <trkpt lat="52.167" lon="0.390"> <name>MSR</name> <desc>Microsoft Research, Cambridge</desc> </trkpt> </trkseg> </trk> </gpx>
The reader uses the
ElementTree
module, so should be very fast when importing data. The above file processed byimport_locations()
will return the followinglist
object:[[Trackpoint(52.015, -0.221, "Home", "My place"), Trackpoint(52.167, 0.390, "MSR", "Microsoft Research, Cambridge")], ]
Parameters: gpx_file (iter) – GPX data to read Returns: Locations with optional comments Return type: list
-
-
class
upoints.gpx.
Waypoint
(latitude, longitude, name=None, description=None, elevation=None, time=None)[source]¶ Bases:
upoints.gpx._GpxElem
Class for representing a waypoint element from GPX data files.
New in version 0.8.0.
See also
_GpxElem
Initialise a new
_GpxElem
object.Parameters:
-
class
upoints.gpx.
Waypoints
(gpx_file=None, metadata=None)[source]¶ Bases:
upoints.point.TimedPoints
Class for representing a group of
Waypoint
objects.New in version 0.8.0.
Initialise a new
Waypoints
object.-
export_gpx_file
()[source]¶ Generate GPX element tree from
Waypoints
object.Returns: GPX element tree depicting Waypoints
objectReturn type: etree.ElementTree
-
import_locations
(gpx_file)[source]¶ Import GPX data files.
import_locations()
returns a list withWaypoint
objects.It expects data files in GPX format, as specified in GPX 1.1 Schema Documentation, which is XML such as:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <gpx version="1.1" creator="PocketGPSWorld.com" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> <wpt lat="52.015" lon="-0.221"> <name>Home</name> <desc>My place</desc> </wpt> <wpt lat="52.167" lon="0.390"> <name>MSR</name> <desc>Microsoft Research, Cambridge</desc> </wpt> </gpx>
The reader uses the
ElementTree
module, so should be very fast when importing data. The above file processed byimport_locations()
will return the followinglist
object:[Waypoint(52.015, -0.221, "Home", "My place"), Waypoint(52.167, 0.390, "MSR", "Microsoft Research, Cambridge")]
Parameters: gpx_file (iter) – GPX data to read Returns: Locations with optional comments Return type: list
-