GPX File Analysis – How to Extract Speed Data from .gpx Files

gpsbabelgpx

Sometimes the .gpx file that you obtain from your GPS-Device does not deliver the speed. The file looks like this:

[...]
<trkpt lat="59.4179482758" lon="3.6870684847">
    <ele>518.38</ele>
    <time>2016-07-17T08:27:18Z</time>
</trkpt>
[...]

The speed is missing.
How is it possible to obtain the speed?

Best Answer

Download GPSBabel - for Ubuntu just use:

sudo apt-get install gpsbabel 

With this command you will get a .gpx file of all track points with the speed (meter/second):

gpsbabel -t -i gpx -f input.gpx -x track,speed -o gpx -F output.gpx

EDIT: please see comment by drnextgis - the command requres the addition of ',gpxver=1.0' and should therefore be as below:

 gpsbabel -t -i gpx -f input.gpx -x track,speed -o gpx,gpxver=1.0 -F output.gpx

The .gpx will look like this then:

[...]
<trkpt lat="59.414788801" lon="2.694040049">
    <ele>624.630000</ele>
    <time>2016-07-17T08:30:28Z</time>
    <speed>2.338139</speed>
</trkpt>
[...]

It is also possible to obtain other output formats like .csv:

gpsbabel -t -i gpx -f input.gpx -x track,speed -o unicsv -F output.csv

The result will look like this then:

No,Latitude,Longitude,Altitude,Speed,Date,Time
1,59.414697,3.693597,521.3,0.00,2016/07/17,10:30:14
2,59.414704,3.693641,521.3,3.28,2016/07/17,10:30:15
3,59.414789,3.694040,524.6,2.34,2016/07/17,10:30:28
[...]