How to find the steepest part of a hike from a GPX file
A hike's average grade is a real number and not a wrong one, but it is built by spreading every metre of climbing evenly across every metre of distance, which is precisely the operation that erases the one short, brutal pitch a hike is actually remembered for. A GPX file was never storing that average to begin with — it stores a plain list of points, each with a position, an elevation and a time, and grade at any point along the route is something calculated afterwards from that list. Finding the steepest stretch uses the same raw points a step differently, and runs into exactly one problem worth knowing about before you start.
The short answer
Walk through the track's points in order, and instead of computing one grade for the whole hike, compute it for a lot of short, overlapping stretches — every 20 to 50 metres of distance covered, say, rather than every single point-to-point step. For each stretch, take the elevation change and divide it by the distance covered to get a grade, exactly as you would for the whole hike. The stretch with the highest grade is the steepest part of the route, and the elevation and distance figures behind it are already sitting in the file — nothing about a standard GPX track needs to be recorded specially for this to work.
Why one average grade can never answer this
Average grade divides total elevation gain by total distance, which by construction treats every metre of the hike as though it climbed at the same steady rate. A route that is a flat approach, one sharp pitch, and a gentle ridge afterwards can average out to a modest, entirely honest 8 percent, while the pitch itself, taken on its own over a few dozen metres, might run closer to 30. The average is not lying — it is answering a different question than "where did this get steep," and no amount of staring at one number pulled from the whole route is going to answer the second question instead.
Splitting a hike into per-kilometre or per-mile splits, the way you would for pace, runs into a milder version of the same problem. A short, sharp climb sitting inside an otherwise gentle kilometre still gets blended with the rest of that kilometre, just over a smaller stretch than the whole hike. Finding the steepest part specifically means working in a unit short enough that a real pitch cannot hide inside it.
What a GPX file already has for this
A GPX track is a plain ordered list of points, each one a latitude, a longitude, usually an elevation, and a timestamp. That is the same raw material behind every derived number a hike report shows — total distance, total elevation gain, average pace, average grade — all of them calculated fresh from the same list rather than stored in the file as numbers of their own. Grade over a short stretch of the route is one more thing that list can be turned into, using nothing that is not already there: the elevation and distance of a handful of consecutive points is enough.
The wrinkle: point-to-point elevation is too noisy to use directly
Elevation is the noisiest figure a phone records, noisier than position, and a single point-to-point elevation change can jump by a few metres purely from that noise, with no real climbing behind it at all. Do this calculation between only two consecutive points — often just a few metres apart, logged a few seconds apart — and a stretch of level ground can occasionally produce a grade reading of 30 or 40 percent out of nowhere, purely because one elevation reading happened to land a couple of metres high and the next a couple of metres low. That single bogus stretch would win "steepest part of the hike" over every real climb in the file if it were left in.
Widening the stretch to a fixed distance — 20 to 50 metres is usually enough — fixes this, because it divides a genuine elevation change over enough distance that a few metres of noise on either end barely moves the result, while a real pitch that runs for fifty metres or more still shows up clearly. Too narrow a window and noise wins; too wide a window and a short pitch gets blended back into the flatter ground around it, the same dilution that per-kilometre splits already have. Somewhere in between is where a real, short climb is both visible and trustworthy.
Working through it, with real numbers
Say a track logs a point roughly every five metres. Over one 40-metre stretch, elevation climbs from 210 to 214 metres — 4 metres of gain over 40 metres of distance, a grade of 10 percent. The very next 40-metre stretch climbs from 214 to 226 metres — 12 metres of gain over 40 metres, a grade of 30 percent. Move on again and the following stretch only gains 2 metres over 40, back down to 5 percent. The 30 percent stretch in the middle is the steepest part of this route, and it would have been sitting silently inside a single average of maybe 12 or 15 percent for the whole climb if nobody had gone looking at anything shorter than the total.
Where TrailCam fits in
TrailCam draws the elevation profile underneath a replayed route, so a short, sharp pitch is visible as a steep section of the curve rather than something buried inside one average grade for the whole hike. For anyone who wants to run the calculation above directly, a route exports as GPX 1.1 or CSV with every recorded point intact, which is exactly the raw material this method needs. Export is part of the optional TrailCam Pro upgrade; the app itself is free to download.
Questions
- Can I see the steepest part of a hike without calculating grade myself?
- Yes — the elevation profile under a replayed route shows exactly where the curve gets steep, which is the same information this calculation produces, just read off a chart instead of computed from raw points.
- Why does the steepest section change depending on the distance window I use?
- A narrow window is noisier, because a few metres of elevation error move a bigger share of a short stretch. A wide window blurs a short, real pitch back into the flatter ground around it. Somewhere between about 20 and 50 metres usually balances the two, but the exact figure is a choice, not a fixed rule.
- Is the steepest part of a hike the same thing as its highest point?
- No. The highest point is about elevation alone. The steepest part is about how quickly elevation changed over a short distance, and a long, gentle climb to a high summit can easily have a less steep worst stretch than a short, sharp pitch much lower down the same route.
Recording your own routes
TrailCam is an iPhone app that records your route with GPS, keeps video clips, photos and voice notes pinned to the spot where you took them, and exports the result as GPX 1.1 or CSV. It is free to download.