Why calculating elevation gain is not so simple

A GPS track consists of a sequence of points, each of which may contain a geographic coordinate and an elevation.

Consider, for example, the following sequence of elevations:

100.0 m    100.8 m    100.2 m    101.0 m    100.5 m    101.2 m

The terrain could be substantially flat, while the variations recorded by the GPS produce a sequence of small climbs and descents.

A calculation that simply added up all the positive changes would also consider these fluctuations as positive elevation gain.

The problem is therefore to determine which elevation changes are significant enough to represent a real climb and which can instead be attributed to measurement noise.

There is no universal value that can always and rigorously distinguish between the two cases. The choice depends on data quality, point frequency, receiver characteristics and the processing method adopted by the software.

Why different software gives different results

It is quite common to import the same GPS track into different programs and obtain different positive elevation gain values.

This does not necessarily mean that one of the programs is making an error.

Software can in fact adopt different criteria for interpreting elevation changes. Some may apply thresholds or filters to eliminate the smallest fluctuations, others may use more complex algorithms to identify significant changes, while others may reprocess the elevations using an external elevation source.

Consequently, elevation gain is not an absolute property of the track independent of the processing method: the result also depends on how the elevation information is interpreted.

This explains why comparing the same track with different programs can produce significantly different values.

The role of GPS elevation quality

The quality of the elevations contained in a track depends on several factors.

  • quality and characteristics of the GPS receiver;
  • satellite reception conditions;
  • surrounding environment, such as the presence of mountains, trees or buildings;
  • frequency at which points are recorded;
  • method used by the device to determine elevation;
  • any processing of the elevations performed by the device before saving the track.

It is therefore possible for two tracks recorded along the same route to have slightly different elevation profiles.

Even a seemingly very detailed track is not necessarily more accurate from an elevation perspective: a high number of points can in fact make small elevation fluctuations even more apparent.

How can the effect of noise be reduced?

To obtain a more realistic elevation gain value, it is necessary to try to distinguish significant elevation changes from fluctuations caused by measurement error.

Different methods can be used. In general, they may include, for example:

  • elimination or attenuation of very small variations;
  • analysis of elevations over a certain distance rather than point by point;
  • comparison between previous and subsequent points;
  • identification of actual changes in the trend;
  • filtering or smoothing of the elevation series.

Each strategy has advantages and disadvantages. Excessively aggressive processing can eliminate real variations, while processing that is too permissive can count GPS noise as elevation gain.

The goal is therefore to find a compromise that preserves significant elevation changes while reducing the contribution of random fluctuations.

How OkMap calculates elevation gain

OkMap uses an algorithm specifically designed to try to distinguish real elevation changes from fluctuations caused by GPS measurement error.

The algorithm therefore does not automatically consider every difference between two consecutive elevations as a climb or descent. The elevation profile is analyzed also by considering the variations occurring around the point being examined, in order to reduce the likelihood that a small fluctuation will be interpreted as a real change in slope.

The goal is to obtain an elevation gain value that represents the actual profile of the route as closely as possible, avoiding the elevation noise in the track being added to the elevation gain actually covered.

The method was developed and experimentally tested on numerous GPS tracks and real routes, with particular attention to outdoor activities.

Naturally, no algorithm can reconstruct the actual elevation with absolute certainty from a noisy GPS measurement. The result should therefore be considered an estimate of elevation gain, not an absolute measurement.

GPS elevations and DEM elevations

An alternative way to obtain elevations is to use a DEM (Digital Elevation Model) instead of the elevations recorded in the GPX file.

In this case, each point of the track is assigned the elevation from the digital terrain model. This can be useful when GPS elevations are particularly noisy or when a consistent elevation source is desired for the entire track.

This solution also has limitations. Accuracy depends on the quality, resolution and coverage of the DEM used. In addition, the resulting value still depends on how the elevations are subsequently processed to determine the elevation gain.

To learn more about using DEMs in OkMap, see the articles DEM: Digital Elevation Models and SRTM, Copernicus and other DEMs: which one should you choose?.

Positive and negative elevation gain

The elevation processing method is used both to calculate positive and negative elevation gain.

Positive elevation gain is the sum of elevation changes considered to be uphill, while negative elevation change is the sum of changes considered to be downhill.

The two values do not necessarily have to be equal and can be influenced by the characteristics of the track and the method used to process the elevations.

It is also important not to confuse elevation gain with the difference between maximum and minimum elevation: the latter only measures the elevation range between the two extreme points and does not take into account any intermediate climbs and descents.

Why values can change after editing a track

Editing a GPS track can also affect the calculated elevation gain. Adding, removing or moving points changes the sequence of elevations used by the algorithm.

To obtain a more stable result, it is generally useful to optimize the track before calculating elevation gain, removing any spikes, point clusters and redundant points. An excessively dense track or one characterized by numerous elevation anomalies can in fact increase the contribution of GPS noise to the elevation gain calculation.

Reducing the number of points does not, however, mean indiscriminately removing information from the track. The goal is to maintain a sufficiently faithful representation of the route, mainly removing redundant points or those associated with anomalous variations. In this way, the algorithm can focus on genuinely significant elevation changes.

For this reason, after editing or optimizing a track, the elevation gain may be different from that calculated for the original track.

What does "correct elevation gain" mean?

There is not always a single value that can be considered mathematically correct.

For a real GPS track, we do not know the exact elevation of the terrain at every moment of the route. We have a series of measurements affected by errors and we must interpret them.

A good algorithm should therefore:

  • reduce the contribution of GPS noise;
  • preserve actual elevation changes;
  • avoid removing climbs and descents that were actually covered;
  • produce consistent results even for tracks with different characteristics.

Comparing different software should therefore take into account the processing method used, as well as the quality of the elevations contained in the track.