Open sjakobi opened 1 year ago
AFAIK it's currently impossible to express cost functions of this shape in BRouter.
Yes, there is currently no way to directly relate the cost factor to the (internally calculated) slope of a way segment.
Therefore downhillcostfactor and uphillcostfactor can't vary for different inclines.
Correct, but they can at least vary for different types of ways, see: Allow hill cost and hill cutoff in way context
there is currently no way to directly relate the cost factor to the (internally calculated) slope of a way segment
It would be very useful to simply expose the slope in a named variable for use in scripts. For instance, the energy spent when walking/hiking is nonlinear vs the slope, so calculating energy-based costs is impossible. Maybe there is some hack or workaround I am missing?
Should I make a new issue on this repo to request this specifically so it can be labeled and tracked?
@lukasmericle, I don't think there is an easy way to achieve this, as the slope along the way segments (up to several kilometers long) on which the profile script operates is generally not constant.
Is it possible to infer the slope of a way segment from the two nodes at its endpoints? Do we have access to lat/lon/elevation of those nodes?
If not, are there other routing engines you're aware of that do expose this kind of information? Thanks
Is it possible to infer the slope of a way segment from the two nodes at its endpoints?
Yes, but then you get the "plain ascend" of this segment and neither the maximum nor the minimum slope.
are there other routing engines you're aware of that do expose this kind of information?
I don't know, sorry. But you can already soft limit the max slope in BRouter like this: https://github.com/abrensch/brouter/blob/93b13be1d45bcda20c8bc886ed24adb566bcf748/misc/profiles2/gravel.brf#L35-L38
Two examples with penalties on a scale of 1–10. The bike should be assumed to be a moderately loaded trekking bike.
Example 1:
highway=secondary
withsurface=asphalt
andsmoothness=good
:highway=secondary
Example 2:
highway=track
withtracktype=grade2
,surface=compacted
andsmoothness=bad
:Current state of BRouter
AFAIK it's currently impossible to express cost functions of this shape in BRouter.
downhillcost
,downhillcutoff
,uphillcost
anduphillcutoff
are all constants. Thereforedownhillcostfactor
anduphillcostfactor
can't vary for different inclines.Motivation
I think that fine-grained penalization of inclines would help cyclists to use the road network more effectively and safely. Someone with narrow road tires may prefer taking a moderate ascent on a
grade2
track rather than on a primary highway. Most cyclists would probably prefer to avoid steep descents (say -15% and steeper) entirely.I don't know how this feature should be designed or implemented, but I think it would be a great improvement! :)
(Related / background: https://github.com/poutnikl/Brouter-profiles/issues/29, related earlier issue: https://github.com/abrensch/brouter/issues/22)