qupkene / Tech / The GPX file format
Tech
The GPX file format
It is XML. Once you know the three data types, every import problem becomes obvious.
GPX is a plain XML document. You can open one in a text editor and read it, which is worth doing once, because almost every failed import is visible by eye.
Three data types
wpt, a waypoint. A single named point that stands alone: a car park, a cabin, a river crossing.rte, a route. An ordered list of points you intend to pass through. Sparse, and meant to be navigated to.trk, a track. A recording of where something actually went, dense and usually time-stamped.
Track structure
A trk contains one or more trkseg segments, and each
segment contains trkpt points. A new segment means the recording was
interrupted, which is why a track that was paused and resumed does not draw a
straight line across the map. Each point carries lat and
lon as attributes, and usually ele and time
as child elements.
Where it goes wrong
- Route imported as a track. A route has a handful of points and no timestamps. Software expecting a track draws straight lines between them and reports a nonsense distance.
- No elevation data. If
eleis missing, ascent totals come out as zero. Some tools fill it from a terrain model, which is often more accurate than a barometric recording anyway. See altitude measurement. - Too many points. A one-second interval over ten hours is 36,000 points. Plenty of handheld units choke well before that. Simplify before transferring.
- Extensions. Heart rate, cadence and similar live in vendor-specific
extensionsblocks. Anything that does not recognise the namespace silently drops them, which is correct behaviour and still surprising.
Related formats
KML is Google's equivalent and carries styling information GPX does not. FIT is Garmin's compact binary format, much smaller and not human-readable. TCX is an older Garmin XML format oriented at training data. For sharing a route between two different manufacturers' devices, GPX remains the safest choice precisely because it is simple.