Open sfendrich opened 2 years ago
I just want to leave my 2 cent here... I am not sure how I could start.
comparing just the elevation delta between two points (start & end) is IMHO not suitable at all - It's fine in the case you have a route from down of the valley to up the summit - but even then - a lot of times you have to pass "dips" on your way...
I have spend quite a while to implement some sort of climb detection (and calculation of overall altitude meters that need to be climb) on my app - where I use the route from A to B - then normalize the distance (cut into 25m sections) and calculate multiple alt-delta's per section... in order to get some reasonable data for slope and estimated effort data...
I would be very happy to share my experience with you guys.
A quick inspection of the data revealed the following insight: The swiss-rando polynomial makes no sense beyond a slope of 40%. Within the 40% it is easily approximated with a 2nd order polynomial with an error of less than 30s/km, e.g.:
t_to s l = l * (14.1399 + 0.485692 * s + 0.0242169 s^2)
It has a smoother curve and seems to make more sense from a modelling perspective.
@marq24 exactly, the swiss-rando model is applied to sections of constant slope, i.e., to estimate time from start to end one would have to split the route into such sections. We would be happy, if you would share your insights.
The swiss-rando model is a curve fitting of this graph which, as far as I know, was based on measurements on the field. https://i0.wp.com/www.nellanatura.it/wp-content/uploads/2016/11/Diagramma-tempi.jpg?w=800&ssl=1
I've tested the formula to calculate the hiking time on kml traces extracted from openrouteservice, applying it to each point in the trace, and the results look reasonable.
I've looked at the second order approximation, it fits quite well except for negative slopes where it differs about 40% from the original formula. A better approximation could be the fourth order 1.4787E+01 + 2.9138E-01 x + 2.5086E-02 x^2 + 1.0963E-05 x^3 + 3.6935E-08 x^4
For slopes above 40% it could be reasonable to keep a constant vertical speed, even if slopes above that one look more like a difficult ski slope than a hiking track.
The OP of the topic provided some code example: https://ask.openrouteservice.org/t/hiking-path-time/3536/6
Sorry, I put a wrong formula above. This coefficient set is much better:
14.14221824, 0.293799084, 0.031619121, 3.88741E-05, -5.70469E-06, 3.37396E-08
The resulting fifth order equation matches the one from swisse-rando with less than 2% error in slopes ranging between -30% and +40%. Below and above those values, it is reasonable to keep a constant vertical speed.
@Huntani Of course, as for the original formula, downward slopes would need a different polynomial (. The above is just an example.t_from
instead of t_to
)
EDIT see @Huntani's correction below
@sfendrich The polynomial applies both for downward and upward slopes. The two formulas above are just used to calculate the time forwards and backwards, the second one is the same as the first one replacing "s" with "-s".
@Huntani Thanks for the clarification!
A fourth order polynomial that approximates the swiss-rando polynomial (SRP) well is f(x) = 14.1744 + 0.291215 * x + 0.0312744*x**2 + 6.20369e-05*x**3+-4.96421e-06*x**4
. It has a smoother curve than the SRP, as its derivative lacks the bounces of the SRP derivative (see figure). However, like the SRP, f makes no sense for slopes beyond +/-40%. Similar things are true of @Huntani 's fifth order polynomial, which has a good continuation beyond +40%, but makes no sense beyond -40%. Maybe a good compromise between precision and other good properties might be a third order polynomial like 15.3174+0.291215*x+0.0242997*x**2+6.20369e-05*x**3
.
Summary from internal discussions:
I think that using the resolution of the nodes during the routing is already better than using no altitude information. Postprocessing could be used just for a more accurate information once a route is selected.
On the other side, pre-processing an area adding the time for every edge in the graph would be too resource consuming?
This issue is based on the forum post https://ask.openrouteservice.org/t/hiking-path-time/3536, stating that one might get better estimations of hiking times by using the swiss-rando formula. The formula is found in the excel file linked on the page https://www.suisse-rando.ch/fr/signalisation/signalisation/temps-de-marche (Version 2020.1):
The constants are given at two places in the excel sheet with two different precisions.
Currently, the status of this formula is unclear. As far as I have read, the formula has been derived as a polynomial approximation of a dataset of recorded hiking times. This is a purely numerical approximation and might be subject to overfitting. At least it is unclear what the different monomials mean intuitively, e.g., why is the third power of the slope scaled negatively and the fourth positively?
EDIT: constants updated to higher precision