I am trying to get data from a GPX file like this:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creator="Kurviger.de" version="1.1" xmlns:gh="https://kurviger.de/public/schema/gpx/1.1">
<metadata>
<link href="https://">
<text>text</text>
</link>
<time>2021-12-21T14:53:19Z</time>
</metadata>
<trk>
<name>data.gpx</name>
<trkseg>
<trkpt lat="55.015102" lon="15.275796"><speed>55.987000</speed><time>2021-12-21T14:53:19Z</time><desc>1</desc></trkpt>
<trkpt lat="55.015224" lon="15.275687"><speed>55.987000</speed><time>2021-12-21T14:53:19Z</time><desc>1</desc></trkpt>
<trkpt lat="55.015358" lon="15.275580"><speed>55.987000</speed><time>2021-12-21T14:53:19Z</time><desc>1</desc></trkpt>
<trkpt lat="55.015495" lon="15.275477"><speed>55.987000</speed><time>2021-12-21T14:53:19Z</time><desc>1</desc></trkpt>
</trkseg>
</trk>
</gpx>
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:
gpx_file = open("route.gpx", "r")
gpx = gpxpy.parse(gpx_file)
data = gpx.tracks[0].segments[0].points
As 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?
Thanks to the comment of Gui LeFlea I tried
gpxpy.parse(gpx_file,version="1.0")
and this did the job.