Mapping from GPS files

I’m just back from a 7 day cycle tour of Arran, Islay, Bute and the bits in between. I wanted to create a map of the route from the GPS log files of my ride, these are in Garmin’s tcx format. I had seven files, one for each day. My mapping software of choice is QGIS, which doesn’t read tcx files; however, the excellent GPSBabel does and will convert them to something more useful (e.g. gpx). I wrote a little bash script to loop through the seven files and saved it as convert.sh in the same directory as the tcx files:

#!/bin/bash
for f in *.tcx
do
    tmpfn=${f%.*}
    newfilename=${tmpfn}.gpx
    gpsbabel -i gtrnctr -f $f -o gpx -F $newfilename
done

Note the extra couple of lines to rename the file, thanks to this stack exchange answer!

I ran this script by entering the following in a terminal:

# Change directory to location of script and tcx files
cd ~/dir
# Run script
sh convert.sh

Finally, you can start QGIS and make your map. If you’re new to GIS, this is a good resource to start with: QGIS training material. I chose to use the Ordnance Survey miniscale dataset as a background and set it to grey-scale to bring out the route lines. Load the gpx files using the vector dataset button and choose tracks from the list of layers. The results are below. For those of you thinking the distances are short, we had a toddler literally in tow! My bike, trailer and luggage was ~ 60 kg.

route

Seven days of Scottish island cycle touring, map created using GPSBabel and QGIS.

Advertisements