########################################################################################## GPXIN-38: Total Climb/Descent ########################################################################################## Issue Type: New Feature ----------------------------------------------------------------------------------------- Issue Information ==================== Priority: Major Status: Open Resolution: Unresolved Project: PHP GPXIngest (GPXIN) Reported By: btasker Assigned To: btasker Targeted for fix in version: - 1.04 Time Estimate: 0 minutes Time Logged: 0 minutes ----------------------------------------------------------------------------------------- Issue 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: -- BEGIN QUOTE -- 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. -- END QUOTE -- 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 -- BEGIN SNIPPET -- 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[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 -- END SNIPPET -- ----------------------------------------------------------------------------------------- 2019-05-20 17:27:11 btasker ----------------------------------------------------------------------------------------- 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 ----------------------------------------------------------------------------------------- 2019-05-20 17:37:12 btasker ----------------------------------------------------------------------------------------- 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. -- BEGIN QUOTE -- 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) -- END QUOTE --