BRouter trekking: avoid fords / grade5 tracks / bad-visibility trails by default

Routed through icy fords and abandoned descents 3x. Penalise ford nodes & ways
(ford=yes|stepping_stones), tracktype=grade5 and trail_visibility=bad|horrible|no in
the trekking profile, gated by a new %allow_adventure% param (default false = avoid).
Both profile copies (asset + staging) kept in sync. NOTE: profile syntax must be
verified by routing on device; a bad profile makes routeBrouter error out (safe), not
produce bad routes.
This commit is contained in:
4aiman 2026-10-26 21:08:22 +03:00
commit 85aa87edb0
2 changed files with 462 additions and 6 deletions

View file

@ -58,6 +58,8 @@ assign processUnusedTags = false # %processUnusedTags% | Set true to
assign unpavedPenalty = 1.0 # %unpavedPenalty% | Extra penalty multiplier applied to the non-probablyGood cost of track/road/path/footway ways depending on tracktype grade | number
assign allow_adventure = false # %allow_adventure% | Set true to ALLOW fords, grade5 tracks and bad-visibility trails (adventure mode). Default false avoids them. | boolean
---context:way # following code refers to way-tags
# classifier constants
@ -128,9 +130,16 @@ assign initialclassifier =
# this is added to the total cost each time the costfactor
# changed
#
# Adventure penalty: keep the router off fords, abandoned (grade5) tracks and
# bad/invisible trails unless the rider opts into adventure mode (%allow_adventure%).
assign adventurepenalty =
if allow_adventure then 0
else add ( if ford=yes|stepping_stones then 100000 else 0 )
( if or tracktype=grade5 trail_visibility=bad|horrible|no then 20000 else 0 )
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
else 0
add adventurepenalty
( if ( equal initialclassifier classifier_ferry ) then 10000 else 0 )
#
# implicit access here just from the motorroad tag
@ -432,7 +441,7 @@ assign footaccess =
else not foot=private|no
assign initialcost =
if or highway=traffic_signals and highway=crossing crossing=traffic_signals then 20
else
if bikeaccess then 0
else ( if footaccess then 100 else 1000000 )
add ( if allow_adventure then 0 else if ford=yes|stepping_stones then 100000 else 0 )
( if or highway=traffic_signals and highway=crossing crossing=traffic_signals then 20
else if bikeaccess then 0
else ( if footaccess then 100 else 1000000 ) )