tkrajina / gpxpy

gpx-py is a python GPX parser. GPX (GPS eXchange Format) is an XML based file format for GPS tracks.
Apache License 2.0
987 stars 223 forks source link

Elevation calculation #46

Closed svendroid closed 8 years ago

svendroid commented 8 years ago

I realized that the calculation of the elevation (uphill, downhill values) differs quite a lot from other tools. In my case I use the movescount.com webpage and GPSMaster and the values are significant higher than the gpxpy values.

The reason for this is that the elevations are smoothed in the calculations. When removing the smoothed part I get similar values as with the other tools. see https://github.com/svendroid/gpxpy/commit/7af065b71fd2687cf9e8a27b4ff1bb84200f5913.

Why is the smoothing done? Is it more accurate than just adding the differences? Could you maybe give me a link to more information about this approach?

Thanks a lot for the nice lib, Sven

tkrajina commented 8 years ago

Why is the smoothing done? Is it more accurate than just adding the differences?

Well, in most cases it is. In most cases the elevation is not accurate from point to point. That's why I'm doing it.

If you want I can add the option to calculate the "raw" uphill/downhill elevation gain/loss.

Or, we can also calculate the medium elevation distance between points. In most tracks (if you are not driving a helicopter) this value should be small. Then based on that value you can decide if to smooth or not.

svendroid commented 8 years ago

Raw elevation values are doing the thing for me at the moment because my gpx files are all from the same device and therefore are similar accurate, I hope. But a quality value of the elevation differences between points sounds like a good option if you use gpx files from different sources and want to switch between the raw and smoothed option.