GPX – fun and games with standards

I’ve mentioned a few times the fun and games involved in getting “standard” GPX files created by various applications and devices into Garmin Connect. Back in November 2011, I mentioned using an application to convert GPX files created by Runkeeper into TCX files that Garmin Connect could read. As I’d stopped using Runkeeper (other than using it to automagically grab data from Garmin Connect, which then get automagically linked to my Withings account), I’d more or less forgotten about this.

But when I started using Geotag Photos Pro, it all came back to me. I was hoping that I could use one app to create the data I need for geotagging photographs taken with the Fujifilm X100S and log my activity. Easy enough, just upload the relevant GPX file into Garmin Connect, and off you go. But no. What happens when you do that is that the Garmin site stares at you, shrugs its shoulders and grunts. Well, OK, what it actually does is show an error message of the “err, didn’t work” variety, which isn’t terribly helpful. But this time I did a bit more searching and reading, and on a forum, I found the solution. I neglected to save the link, so I can’t give credit, but it’s a generic enough answer so no doubt multiple people have found it. I’ll post it here so I know where it is.

The thing is, that like all good standards, GPX comes in versions. There’s an old version 1.0, and a moderately recent (only about six or seven or so years old) version 1.1. Garmin like to be moderately up to date, and so Garmin Connect is expecting to see a properly formatted v1.1 file. Geotag Photos Pro, and presumably a lot of other things, produces a v1.0 file, which Garmin Connect doesn’t like. Now you’d think that whatever it uses to read the file might spit out a message about “invalid version”, but presumably that would be too hard…

But hold on, what’s actually in a GPX file? Isn’t it just some XML? Indeed, the records in a typical GPX file look like this:

<trkpt lat="54.9712" lon="-1.610842"><ele>71.44318</ele><time>2013-04-24T12:05:31Z</time></trkpt>
<trkpt lat="54.97103" lon="-1.610862"><ele>64</ele><time>2013-04-24T12:06:47Z</time></trkpt>
<trkpt lat="54.97102" lon="-1.610431"><ele>63</ele><time>2013-04-24T12:07:00Z</time></trkpt>

So what’s the problem, then? Well, it’s the header information at the top of the file that tells whatever’s trying to read it what sort of file it is. In the case of Geotag Photos Pro, the header looks like this:

<gpx creator="Geotag Photos http://www.geotagphotos.net/" version="1.0"
xmlns="http://www.topografix.com/GPX/1/0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">

You’ll notice it says it’s version 1.0 and there are some 1/0 references in the numerous URLs. So all you have to do is change that header to one more like this:

<gpx creator="Geotag Photos http://www.geotagphotos.net/" version="1.1"
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">

Save the file with the new header, and Garmin Connect will happily read it and add it to your activities.
You can save that as a standard block of text, or use a tool such as TextExpander to drop it in for you. Or just edit it manually – it’s just a matter of changing 1.0 to 1.1 and 1/0 to 1/1.

One thought on “GPX – fun and games with standards

  1. Pingback: Weight and Stuff Report – 26 April 2013 | Losing it

Comments are closed.