From 2cc16e0ed6f29082b87c25087fbfc05b2fb0f345 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Tue, 27 Oct 2026 14:06:22 +0300 Subject: [PATCH 1/3] 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. --- .../brouter/profiles2/trekking-adventure.brf | 20 +++++++++++++++++++ .../assets/brouter/profiles2/trekking.brf | 20 +++++++++++++++++++ .../profiles2/trekking-adventure.brf | 20 +++++++++++++++++++ .../profiles2/trekking.brf | 20 +++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf index 73e06f1..fb3d4ae 100644 --- a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf +++ b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking-adventure.brf @@ -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 diff --git a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf index 45b59f5..1635ad4 100644 --- a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf +++ b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf @@ -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 diff --git a/tools/brouter-web-staging/profiles2/trekking-adventure.brf b/tools/brouter-web-staging/profiles2/trekking-adventure.brf index 73e06f1..fb3d4ae 100644 --- a/tools/brouter-web-staging/profiles2/trekking-adventure.brf +++ b/tools/brouter-web-staging/profiles2/trekking-adventure.brf @@ -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 diff --git a/tools/brouter-web-staging/profiles2/trekking.brf b/tools/brouter-web-staging/profiles2/trekking.brf index 45b59f5..1635ad4 100644 --- a/tools/brouter-web-staging/profiles2/trekking.brf +++ b/tools/brouter-web-staging/profiles2/trekking.brf @@ -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 From ab1259eb206906c28c6a29ae175358e5d02876c2 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Tue, 27 Oct 2026 14:09:04 +0300 Subject: [PATCH 2/3] brouter-web: directional slope coloring (warm uphill / cool downhill to navy), signed grade --- .../brouter-web/baldav-custom.js | 528 ++++++++++++++++++ 1 file changed, 528 insertions(+) create mode 100644 tools/brouter-web-staging/brouter-web/baldav-custom.js diff --git a/tools/brouter-web-staging/brouter-web/baldav-custom.js b/tools/brouter-web-staging/brouter-web/baldav-custom.js new file mode 100644 index 0000000..2d2786e --- /dev/null +++ b/tools/brouter-web-staging/brouter-web/baldav-custom.js @@ -0,0 +1,528 @@ +(function () { + var LS_DARK = "baldav_bw_dark"; + function isDark() { try { return localStorage.getItem(LS_DARK) === "1"; } catch (e) { return false; } } + + // Inject the dark rules as a