GPXIN-38: Total Climb/Descent



Issue Information

Issue Type: New Feature
 
Priority: Major
Status: Open

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: PHP GPXIngest (GPXIN)
Resolution: Unresolved
Target version: 1.04,

Created: 2019-05-20 17:09:24
Time Spent Working


Description
A user has commented on commit 8cd27f0 with some requirements (and potentially a misunderstanding) for the statistics that are generated regarding elevation.

From the information provided it looks like they require a stat to record the total climb/descent across the course of the stat.

What isn't clear is exactly how they want this to be calculated, as in the screenshot (https://projectsstatic.bentasker.co.uk/GPXIN/GPXIN_38-Total_Climb/example_data.jpg) provided the numbers don't seem to add up the way I'd expect them to:

I'm not sure what criteria has been used to calculate the value in the screenshot though? It shows the max elevation as 1298m and the min as 1175 - the difference between those is 123m, but the screenshot says 132m.


The user has also provided an example GPX file - https://projectsstatic.bentasker.co.uk/GPXIN/GPXIN_38-Total_Climb/posteggio-laghetto-del-pertus-passo-del-pertus-posteggio-lag.gpx and some quick calculations with awk also give me 123m
ben@milleniumfalcon:~$ cat ~/Downloads/posteggio-laghetto-del-pertus-passo-del-pertus-posteggio-lag.gpx | tr '<' '\n' | egrep "ele>[0-9]+" | grep -o -P "[0-9,\.]+"| awk 'BEGIN{n=0;mx=0;mn=9999999;tot=0}{if ($1>mx){ mx=$1}; if ($1<mn){mn=$1}}END{print mx,mn,mx-mn}'
1298.096 1175.414 122.682



Toggle State Changes

Activity


I think having a total climb/descent statistic is likely pretty value, but I really need to understand how they came to 132m in the user's screenshot.

I wondered if perhaps 132 came from summing each climb (as that may be more than the range between min-max, if you think about having to climb a little, descend a little and then climb some more).

But, summing the climbs and descents doesn't get me 132m either
ben@milleniumfalcon:~$ cat ~/Downloads/posteggio-laghetto-del-pertus-passo-del-pertus-posteggio-lag.gpx | tr '<' '\n' | egrep "ele>[0-9]+" | grep -o -P "[0-9,\.]+"| awk 'BEGIN{n=0;up=0;dn=0}{if(n!=0){d=$1-n}else{d=0}; n=$1; if(d>0){up=up+d}else{dn=dn+d}}END{print up,dn}' 
261.104 -261.481
Ah, there's an english version of the website too - https://www.wikiloc.com/hiking-trails/posteggio-laghetto-del-pertus-passo-del-pertus-posteggio-laghetto-del-pertus-19382270

It's labelled as "Elevation gain uphill" and "Elevation gain downhill"

The english version gives me the details in feet, but still has the delta compared to max and min height on the page.

It looks as though the GPX file provided was downloaded from there (though I'd need to register to compare), so it's a little hard to say
I've dropped a comment onto Github to try and find out which it is the user is after. My main concern is I don't know if I've got the spare time to implement, particularly if it's not going to be used.
OK, so I'm not sure why the number on that site differs (I found the english translation - https://www.wikiloc.com/hiking-trails/posteggio-laghetto-del-pertus-passo-del-pertus-posteggio-laghetto-del-pertus-19382270 ) and it differs there too.

There are basically two ways this could be calculated internally:

- Simple: MaxEle - MinEle (in this case 123m)
- Complex: sum(trkpt.EleGain), sum(trkpt.EleDrop). In this case 261.104m, -261.481m

The first gives a raw idea of how much higher you are at the highest point than the lowest point, but doesn't give you any indication of how much you'll actually have to walk up, and down.

The second is a calculation of the elevation you'll walk up (and down).

That's probably not the clearest explanation, so:

- Imagine walking along a ridge of peaks, some higher than the others.
- The tallest is 50m higher than your lowest point
- You have to walk up (and then down) two 20m peaks to reach the 50m peak
- The first type of statistic will tell you you climbed 50m
- The second type will tell you you walked up (about) 90m (up 2x20 followed by a 50m)
- You can already calculate the first type by subtracting ['elevation']['min'] from ['elevation']['max'], the second would require code changes to implement.

The second, I guess, is probably more relevant when you're planning a walk based on someone else's file, continuously walking up and down dips can be harder going than a straight climb.

But, that second statistic is also nowhere near the figures in your screenshot (I roughly calculate it as 261m)