§ I · GPX Guide

How elevation gain in a GPX file is (really) computed

Elevation gain is the most-watched number on a track — and the most inconsistent from one tool to the next. Here is why, and how to read it cleanly.

7 min read

I.Why the same file gives three different elevation gains

You load the same track into Strava, into Garmin Connect, and into a third GPX reader. Three different elevation gains. A hundred metres apart on a three-hour outing, sometimes more. Which one is right? None of them, and all of them. Elevation gain — the cumulative climb, often called D+ — is not a number stored in the file. It's a calculation done after the file is read, and every tool does it differently.

Two choices, in particular, account for almost all of the gap between figures: the elevation source the tool decides to trust, and the way it filters the noise from that elevation before adding up the climbs. Neither choice is documented clearly by the vendors — which is what makes those post-run conversations so frustrating.

II.What's (and isn't) inside a .gpx file

A GPX file is a long list of points. Each point carries three pieces of information that matter here: its position (latitude and longitude), its elevation in metres, and the exact moment it was recorded. That's all. On a three-hour outing, your watch typically records one point every second — about ten thousand points in the file.

None of those points says « here is the total gain ». No line in the file gives you that number. Elevation gain is always reconstructed after the fact, by watching how elevation moves from one point to the next. And here, everything depends on where that elevation comes from:

Three sources, three possible numbers — and we haven't even started talking about the calculation itself.

III.The naive method, and why it fails

The most natural way to compute elevation gain is to walk through the track in order and, every time elevation goes up from one point to the next, add the difference. Simple, intuitive — and unusable.

The trouble, as we saw, is that the altimeter jitters. Even motionless, your watch records variations of a metre, sometimes two. On a track of ten thousand points, these tiny oscillations are countless. And because we only add positive variations, the noise never cancels itself: it accumulates. The result is gain inflated by 50 to 200 percent over reality.

This is exactly what happened on the first cycling GPS units of the 2000s. A climb really worth 600 m would display 1 100 m. Forums were full of people comparing their tracks and unable to reproduce the same number — that was the noise speaking, not the mountain.

IV.The fix: stop listening to whispers

The solution is elegant, and it fits in one sentence: only count an elevation change if it crosses a certain threshold. As long as the movement stays below that threshold, we treat it as noise and throw it away. For a « real » climb to register, the watch has to see a clear, decisive change — not a half-metre flicker.

GPXchunk uses a 1-metre threshold. That's the value serious sports tools have converged on over the last decade or so for barometric tracks. Set it too low (half a metre), too much noise leaks through and gain stays inflated. Set it too high (five metres), you miss the genuine rolls of an undulating trail and gain is underestimated. One metre is the trade-off that best matches the trail underfoot: you stop measuring the electronics jitter, and you start measuring the path. The filtered D+ is one of the twelve measures that come out of a GPX track; the other eleven deserve the same careful reading.

V.Why Strava, Garmin and the rest disagree

With what we've just covered, the gap between tools is almost entirely explained. Three choices stack up.

  1. The elevation source isn't the same. Strava often replaces the recorded elevation with elevation from a topographic map. Garmin Connect keeps the barometric elevation from your watch. On a long outing, those two sources can differ by 50 to 100 metres before any filter is even applied.
  2. Some tools smooth the track before computing. They take an average over five or ten consecutive points before looking at variations. This crushes the noise even further — but it also crushes genuine rapid changes, like a step on a trail or a short pitch in gradient. GPXchunk does not smooth: the track you read is exactly the one in your file.
  3. The threshold value differs between vendors. One metre, one and a half, two: each one defends its own number, and sometimes changes it without an announcement. Garmin users remember the day their historical D+ « shifted » by a few percent overnight after a firmware update.

No method is the truth. They are all honest estimates of the same phenomenon. But if you always compare with the same tool, your numbers stay consistent with each other — and that's what matters for tracking progress from one season to the next.

VI.When the measurement breaks down

There are a handful of situations where, no matter the tool, elevation gain stops meaning anything. Worth knowing before you compare too seriously:

VII.Seeing it in practice on GPXchunk

This is exactly where segment-by-segment analysis pays off. On a forty-kilometre outing with a long climb at km 24–28, the total gain blends that climb, undulating cruising before and after, and three hours of accumulated noise. The segment gain isolates the variation you actually want to read — usually the one you actually care about. Gain is just one of the twelve numbers recomputed for that segment alone.

Three clicks: load your file (nothing leaves your browser), drop the handles on the elevation profile at the start and end of the climb, read the segment gain. Then compare with what Strava or Garmin show for that same climb. Most of the time, the gap is small. When it's large, it's almost always because you weren't comparing exactly the same stretch of track.

Frequently asked questions

Why does Strava show 800 m of D+ and Garmin 1,050 m on the same file?
Because Garmin Connect rewrites the elevation through a digital terrain model (DEM) when you sync, while Strava keeps the barometric elevation from your watch and applies a ~3 m noise threshold. GPXchunk takes the elevation as it sits in the .gpx and applies a strict 1 m threshold. On 1,000 m of D+ reported by your watch, the gap between the three tools regularly reaches 200 to 300 m — without any of them being "wrong".
Which noise threshold is most accurate: 1 m, 3 m, 5 m?
None is universally accurate — each is a different trade-off. 1 m (GPXchunk) catches the small real variations of a rolling trail, but allows a bit of GPS noise through. 3 m (Strava) smooths more, loses the small bumps but resists pure GPS recordings (no barometer) better. 5 m+ is too strict for hilly trail. The rule: always compare two tracks with the same tool, never across tools.
Does D+ change depending on whether my watch has a barometer or only GPS?
Yes, and that's the primary source of disagreement. A barometer watch (Garmin Fenix, Suunto Vertical, Coros Apex 2…) measures altitude through atmospheric pressure — ±1 m precision. A GPS-only watch (Apple Watch SE, Garmin entry-level) computes altitude via satellite triangulation — ±5 to 10 m precision, far noisier. On the same outing, D+ can vary by 30 to 40 % between the two types.
Why does my D+ drop after syncing to Strava?
Because Strava applies its « elevation correction »: it replaces your watch's altitude with one from a global terrain model (usually more smoothed, hence lower D+). This option is enabled by default for premium accounts when activities exceed certain thresholds. You can disable it in activity settings — or simply analyse the original .gpx in GPXchunk to see the raw D+ from your watch.

← All guides