← blog

GPX parsing gotchas you won't find in the spec

2026-01-30 · Marco Ferretti

I've parsed GPX files from eight different device manufacturers over the course of building ThornPass. Here are the recurring problems that the spec doesn't warn you about.

Elevation datums are inconsistent

The GPX spec says elevation should be WGS84 ellipsoidal height. Most consumer GPS units record orthometric height (height above the geoid / sea level approximation). The difference is usually 20-60 metres depending on location. For elevation gain calculation this doesn't matter — you're computing relative differences — but for absolute elevation display it does.

Some devices record both and include a geoidheight element. Most don't. ThornPass treats all elevation values as orthometric by default, which is what users expect when they look at a map.

Timestamp gaps

Garmin devices sometimes emit GPX with missing timestamps for individual track points when the GPS signal was weak. These gaps cause problems for speed and moving time calculations. ThornPass linearly interpolates timestamps across gaps shorter than 30 seconds and marks longer gaps as pauses in the segment metadata.

Coordinate precision

Some devices emit coordinates with 15 decimal places of precision. IEEE 754 double precision gives about 15 significant digits total, so the last few decimal places are rounding artefacts. ThornPass rounds to 7 decimal places (about 1cm on the equator) before storing track points, which keeps output files small without affecting usable precision.


Also: ThornPass 1.2: elevation smoothing and segment export