BRouter trekking: cost by surface (dirt < gravel < sand, approved ranking)

Surface was only paved/unpaved binary - gravel, dirt and sand cost the same. Add a
surfacepenalty into costfactor so a dirt track beats a gravel one of the same tracktype
(asphalt 0 < compacted .2 < ground/dirt/earth .4 < cobblestone/sett .6 < gravel .9 <
clay 1.3 < grass/wood 1.5 < sand/mud 5). Canonical lookup values only. Verified on the
home RouteServer: engages on unpaved, doesn't distort paved routes. Untagged-ford
avoidance by estimated_river_class was tried and dropped - it forced 5x detours (flags
riverside ways, not only crossings); untagged fords stay shown (wetcross) + future marks.
This commit is contained in:
4aiman 2026-10-27 14:06:22 +03:00
commit 2cc16e0ed6
4 changed files with 80 additions and 0 deletions

View file

@ -137,6 +137,25 @@ assign adventurepenalty =
if allow_adventure then 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 )
# NB: avoidance by estimated_river_class was tried and dropped — it flags riverside ways too,
# not only crossings, so it forced 5x detours. Untagged fords are SHOWN instead (wetcross on
# the preview) and will be handled by manual ground-truth marks.
# Surface cost (approved ranking, singlespeed): asphalt < compacted < grunтовka(ground/dirt/
# earth/soil) < cobblestone/sett < gravel(all) < clay < grass/wood < sand/mud(avoid). Added to
# costfactor so a dirt track beats a gravel one of the same tracktype.
# canonical lookup values only (aliases fold into them: paved=bricks/brick/chipseal,
# concrete=cement, ground=soil, cobblestone=unhewn_cobblestone, grass=artificial_turf).
assign surfacepenalty =
if surface=asphalt|concrete|paved|paving_stones then 0.0
else if surface=compacted then 0.2
else if surface=ground|dirt|earth then 0.4
else if surface=cobblestone|sett then 0.6
else if surface=gravel|fine_gravel|pebblestone|unpaved then 0.9
else if surface=clay then 1.3
else if surface=grass|grass_paver|wood then 1.5
else if surface=sand|mud then 5.0
else 0.0
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
@ -308,6 +327,7 @@ assign costfactor
add noise_penalty
add traffic_penalty
add adventurepenalty
add surfacepenalty
#
# apply oneway-and access-penalties

View file

@ -137,6 +137,25 @@ assign adventurepenalty =
if allow_adventure then 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 )
# NB: avoidance by estimated_river_class was tried and dropped — it flags riverside ways too,
# not only crossings, so it forced 5x detours. Untagged fords are SHOWN instead (wetcross on
# the preview) and will be handled by manual ground-truth marks.
# Surface cost (approved ranking, singlespeed): asphalt < compacted < grunтовka(ground/dirt/
# earth/soil) < cobblestone/sett < gravel(all) < clay < grass/wood < sand/mud(avoid). Added to
# costfactor so a dirt track beats a gravel one of the same tracktype.
# canonical lookup values only (aliases fold into them: paved=bricks/brick/chipseal,
# concrete=cement, ground=soil, cobblestone=unhewn_cobblestone, grass=artificial_turf).
assign surfacepenalty =
if surface=asphalt|concrete|paved|paving_stones then 0.0
else if surface=compacted then 0.2
else if surface=ground|dirt|earth then 0.4
else if surface=cobblestone|sett then 0.6
else if surface=gravel|fine_gravel|pebblestone|unpaved then 0.9
else if surface=clay then 1.3
else if surface=grass|grass_paver|wood then 1.5
else if surface=sand|mud then 5.0
else 0.0
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
@ -308,6 +327,7 @@ assign costfactor
add noise_penalty
add traffic_penalty
add adventurepenalty
add surfacepenalty
#
# apply oneway-and access-penalties

View file

@ -137,6 +137,25 @@ assign adventurepenalty =
if allow_adventure then 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 )
# NB: avoidance by estimated_river_class was tried and dropped — it flags riverside ways too,
# not only crossings, so it forced 5x detours. Untagged fords are SHOWN instead (wetcross on
# the preview) and will be handled by manual ground-truth marks.
# Surface cost (approved ranking, singlespeed): asphalt < compacted < grunтовka(ground/dirt/
# earth/soil) < cobblestone/sett < gravel(all) < clay < grass/wood < sand/mud(avoid). Added to
# costfactor so a dirt track beats a gravel one of the same tracktype.
# canonical lookup values only (aliases fold into them: paved=bricks/brick/chipseal,
# concrete=cement, ground=soil, cobblestone=unhewn_cobblestone, grass=artificial_turf).
assign surfacepenalty =
if surface=asphalt|concrete|paved|paving_stones then 0.0
else if surface=compacted then 0.2
else if surface=ground|dirt|earth then 0.4
else if surface=cobblestone|sett then 0.6
else if surface=gravel|fine_gravel|pebblestone|unpaved then 0.9
else if surface=clay then 1.3
else if surface=grass|grass_paver|wood then 1.5
else if surface=sand|mud then 5.0
else 0.0
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
@ -308,6 +327,7 @@ assign costfactor
add noise_penalty
add traffic_penalty
add adventurepenalty
add surfacepenalty
#
# apply oneway-and access-penalties

View file

@ -137,6 +137,25 @@ assign adventurepenalty =
if allow_adventure then 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 )
# NB: avoidance by estimated_river_class was tried and dropped — it flags riverside ways too,
# not only crossings, so it forced 5x detours. Untagged fords are SHOWN instead (wetcross on
# the preview) and will be handled by manual ground-truth marks.
# Surface cost (approved ranking, singlespeed): asphalt < compacted < grunтовka(ground/dirt/
# earth/soil) < cobblestone/sett < gravel(all) < clay < grass/wood < sand/mud(avoid). Added to
# costfactor so a dirt track beats a gravel one of the same tracktype.
# canonical lookup values only (aliases fold into them: paved=bricks/brick/chipseal,
# concrete=cement, ground=soil, cobblestone=unhewn_cobblestone, grass=artificial_turf).
assign surfacepenalty =
if surface=asphalt|concrete|paved|paving_stones then 0.0
else if surface=compacted then 0.2
else if surface=ground|dirt|earth then 0.4
else if surface=cobblestone|sett then 0.6
else if surface=gravel|fine_gravel|pebblestone|unpaved then 0.9
else if surface=clay then 1.3
else if surface=grass|grass_paver|wood then 1.5
else if surface=sand|mud then 5.0
else 0.0
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
@ -308,6 +327,7 @@ assign costfactor
add noise_penalty
add traffic_penalty
add adventurepenalty
add surfacepenalty
#
# apply oneway-and access-penalties