BRouter trekking: apply adventure penalty in costfactor (was a no-op in initialcost)
The ford/grade5/bad-trail penalty sat in the way initialcost and never changed the route cost (verified on the home RouteServer: avoid and adventure gave identical cost). Moved it into costfactor next to town/traffic penalties. Verified against a real ford (47.5387,40.3164): avoid now detours 1.4km->6.2km with fords=0, adventure keeps the 1.4km ford crossing. Node-ford penalty (node initialcost) kept.
This commit is contained in:
parent
9d510931ad
commit
640429a209
2 changed files with 16 additions and 12 deletions
|
|
@ -130,16 +130,17 @@ 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%).
|
||||
# Adventure penalty (added into costfactor below): keep the router off fords, abandoned
|
||||
# (grade5) tracks and bad/invisible trails unless the rider opts into adventure mode
|
||||
# (%allow_adventure%). 10000 matches the profile's "excluded way" costfactor.
|
||||
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 )
|
||||
else add ( if ford=yes|stepping_stones then 10000 else 0 )
|
||||
( if or tracktype=grade5 trail_visibility=bad|horrible|no then 5000 else 0 )
|
||||
|
||||
assign initialcost =
|
||||
add adventurepenalty
|
||||
( if ( equal initialclassifier classifier_ferry ) then 10000 else 0 )
|
||||
if ( equal initialclassifier classifier_ferry ) then 10000
|
||||
else 0
|
||||
|
||||
#
|
||||
# implicit access here just from the motorroad tag
|
||||
|
|
@ -306,6 +307,7 @@ assign costfactor
|
|||
add no_river_penalty
|
||||
add noise_penalty
|
||||
add traffic_penalty
|
||||
add adventurepenalty
|
||||
|
||||
#
|
||||
# apply oneway-and access-penalties
|
||||
|
|
|
|||
|
|
@ -130,16 +130,17 @@ 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%).
|
||||
# Adventure penalty (added into costfactor below): keep the router off fords, abandoned
|
||||
# (grade5) tracks and bad/invisible trails unless the rider opts into adventure mode
|
||||
# (%allow_adventure%). 10000 matches the profile's "excluded way" costfactor.
|
||||
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 )
|
||||
else add ( if ford=yes|stepping_stones then 10000 else 0 )
|
||||
( if or tracktype=grade5 trail_visibility=bad|horrible|no then 5000 else 0 )
|
||||
|
||||
assign initialcost =
|
||||
add adventurepenalty
|
||||
( if ( equal initialclassifier classifier_ferry ) then 10000 else 0 )
|
||||
if ( equal initialclassifier classifier_ferry ) then 10000
|
||||
else 0
|
||||
|
||||
#
|
||||
# implicit access here just from the motorroad tag
|
||||
|
|
@ -306,6 +307,7 @@ assign costfactor
|
|||
add no_river_penalty
|
||||
add noise_penalty
|
||||
add traffic_penalty
|
||||
add adventurepenalty
|
||||
|
||||
#
|
||||
# apply oneway-and access-penalties
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue