Closed Loois1995 closed 2 years ago
This should be solved by invoking parse
with a version
argument set to "1.0"
.
gpx_file = open("route.gpx", "r")
gpx = gpxpy.parse(gpx_file,version="1.0")
data = gpx.tracks[0].segments[0].points
# for example
for pt in data:
print(pt.speed)
This should be solved by invoking
parse
with aversion
argument set to"1.0"
.gpx_file = open("route.gpx", "r") gpx = gpxpy.parse(gpx_file,version="1.0") data = gpx.tracks[0].segments[0].points # for example for pt in data: print(pt.speed)
Yes this works. Thank you
Exactly.
From the README says:
For example, GPX 1.0 specified a speed attribute for every track point, but that was removed in GPX 1.1. If you parse GPX 1.0 and serialize back with gpx.to_xml() everything will work fine. But if you have a GPX 1.1 object, changes in the speed attribute will be lost after gpx.to_xml(). If you want to force using 1.0, you can gpx.to_xml(version="1.0"). Another possibility is to use extensions to save the speed in GPX 1.1.
I am trying to get data from a GPX file like this:
As you can see the speed information is given in the gpx file.
To read the data (longitude, latitude, elevation and speed) if seperated the track points like this:
The longitude, latitude, elevation are extracted correctly the speed information isnt. If i try to print it (for the first point for example but the issue can be found at all points):
print(data[0].speed)
None
will be printed.Can anybody help?