From 385009b9e69a0692a96987510e722d5d15edb93a Mon Sep 17 00:00:00 2001 From: vcoppe Date: Tue, 2 Apr 2024 17:23:20 +0200 Subject: [PATCH] add private profiles --- misc/profiles2/Car-FastEco-private.brf | 452 +++++++ misc/profiles2/Hiking-Alpine-SAC6-private.brf | 485 ++++++++ misc/profiles2/MTB-private.brf | 562 +++++++++ misc/profiles2/Trekking-dry-private.brf | 562 +++++++++ misc/profiles2/fastbike-private.brf | 359 ++++++ misc/profiles2/mtb.brf | 1091 ++++++++--------- misc/profiles2/rail-private.brf | 22 + misc/profiles2/river-private.brf | 21 + 8 files changed, 3008 insertions(+), 546 deletions(-) create mode 100644 misc/profiles2/Car-FastEco-private.brf create mode 100644 misc/profiles2/Hiking-Alpine-SAC6-private.brf create mode 100644 misc/profiles2/MTB-private.brf create mode 100644 misc/profiles2/Trekking-dry-private.brf create mode 100644 misc/profiles2/fastbike-private.brf create mode 100644 misc/profiles2/rail-private.brf create mode 100644 misc/profiles2/river-private.brf diff --git a/misc/profiles2/Car-FastEco-private.brf b/misc/profiles2/Car-FastEco-private.brf new file mode 100644 index 0000000..86a6abc --- /dev/null +++ b/misc/profiles2/Car-FastEco-private.brf @@ -0,0 +1,452 @@ +# Car-Routing is experimrntal and expects local failures, as turn restrictions are missing +# It is determined by the current Brouter design, leading to possible wrong routes +# The profile template was originally based on standard Car-test, added speed and eco preferences to roads. +# Progressively more enhancements were added. +# +# V1.0.24 Tweaked initial costs and traffic lights penalty +# +# +# Car profile balancing Speed and Cost - RECOMMENDED +# +# Legend above is placeholder for generated comments of final profile +# See the profile bottom for changelogs and verbose *) comments +# +# See also https://github.com/poutnikl/Brouter-profiles/wiki +# and https://github.com/poutnikl/Car-Profile + +---context:global +assign drivestyle 2 # default is 2; 0=shortest 1=Least estimated fuel consumption + # 2=Balanced fuel consumption and travel time ( default ) 3=fast + +assign fastprofile 0 # %fastprofile% Fast|Prefers low time over balance time and cost. + # default 0=economic, i.e. balanced cost and time, 1=prefers shorter time + # implemented for Locus config switch system + # fastprofile=0 is equivalent drivestyle=2(FastEco), fastprofile=1 is equivalent drivestyle=3(Fast) + +assign avoid_motorways 0 # %avoid_motorways% Avoid motorways|Use for slow vehicles or sightseeing route + # default 0, 1=like if on moped or on sightseeing route. Includes motorroad=yes + +assign avoid_toll 0 # %avoid_toll% Avoid toll|Avoid paid ways and toll points like booths or bridges + # default 0 / 1=avoid paid ways and toll points like booths or bridges + +assign avoid_unpaved 0 # %avoid_unpaved% Avoid unpaved| Unpaved ways are forbidden, otherwise just penalized + # default 0 / 1=avoid unpaved roads, equivalent to road_restriction=2, implemented for Locus confing switches + +assign road_restriction 1 # default 1 ( 4 and above is 1pass only for fast suboptimal calculation ) +assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style / 1 does not work for Brouter-web + +assign consider_smoothness 0 # 1=consider smoothness=* tag + +#road_restrictions +# +# 1=No restriction(Default), with exception of avoid_motorways and avoid_toll +# 2=avoid unpaved - forbidden to ever use unpaved roads, if 0/false, unpaved can be used with high penalty +# 3=mainroads and residental roads - forbidden unpaved and minor paved roads/tracks +# 4=mainroads only ( long distance ) - allowed only mainroad network +# 5=mainroads sec ( long distance ) - allowed only mainroad network, secondary and better +# 6=mainroads prim ( long distance ) - allowed only mainroad network, primary and better + +#internal settings ------------------------------------------------------------------------------------ + +assign pass1coefficient if ( greater 5 road_restriction ) then 1.5 else if ( equal 5 road_restriction ) then 1.6 else 1.7 + +assign pass2coefficient if ( greater road_restriction 3 ) then -1 else 0 + +assign short equal drivestyle 0 # 0=short - Shortest way possible ( for completeness, not really useful ) +assign eco equal drivestyle 1 # 1=eco - Least estimated fuel consumption +assign ecofast and equal drivestyle 2 + equal fastprofile 0 # 2=fasteco- Balanced fuel consuption and travel time ( default ) +assign fast or equal drivestyle 3 equal fastprofile 1 + # 3=fast - Least travel time, based on lower of explicit maxspeed or defined nominal speed. + + +assign uphillcost 30 # ( horizontally, 6 L/100 km, 37 MJ/L, 25% engine efficiency gives about 500 J/m. + # ( vertically, 1500 kg car mass gives about 15000 J/m, so uphillcost 15000/500 = 30 ) +assign uphillcutoff 0.5 +assign downhillcost 0 +assign downhillcutoff 1.5 + +assign validForCars 1 + +assign penalty_coef_short 0.0 +assign penalty_coef_fast 1.0 +assign penalty_coef_eco 2.0 +assign penalty_coef_ecofast add ( multiply penalty_coef_fast 0.4 ) ( multiply penalty_coef_eco 0.6 ) + +assign node_penalty_multiplier + switch short penalty_coef_short + switch fast penalty_coef_fast + switch ecofast penalty_coef_ecofast + switch eco penalty_coef_eco + 1.0 + +assign turn_penalty_multiplier + switch short penalty_coef_short + switch fast penalty_coef_fast + switch ecofast penalty_coef_ecofast + switch eco penalty_coef_eco + 1.0 + +assign initial_penalty_multiplier + switch short penalty_coef_short + switch fast penalty_coef_fast + switch ecofast penalty_coef_ecofast + switch eco penalty_coef_eco + 1.0 + +assign road_restriction_ban true + +assign road_restriction_coef if road_restriction_ban then 10000 else 100 + + + +---context:way # following code refers to way-tags + +assign ispaved surface=paved|asphalt|concrete|paving_stones|sett +assign isunpaved not or ispaved or surface= surface=cobblestone + +assign thirdc highway=tertiary|tertiary_link +assign secondc highway=secondary|secondary_link +assign firstc highway=primary|primary_link +assign trunkc highway=trunk|trunk_link +assign motorwayc highway=motorway|motorway_link +assign ismainroadprm or firstc or trunkc motorwayc +assign ismainroadsec or secondc ismainroadprm +assign ismainroad or highway=unclassified or thirdc ismainroadsec +assign urbanc highway=residential|service|living_street + +assign goodroad or ispaved and ismainroad not isunpaved +assign badroad and not goodroad or isunpaved highway=footway|path +assign greyroad and not goodroad not badroad + +# http://wiki.openstreetmap.org/wiki/Key:smoothness + +assign smoothness_penalty +if not consider_smoothness then 1.0 else +if smoothness= then 1.0 else +if smoothness=excellent|very_good|good then 1.0 else +if smoothness=intermediate then 2.0 else +if smoothness=bad|robust_wheels then 4.0 else +if smoothness=very_bad|high_clearance then 10.0 else +if smoothness=horrible|off_road_wheels then 10000 else +if smoothness=very_horrible then 10000 else +if smoothness=impassable then 10000 else +10000 + +assign supposed_speed + if or maxspeed=10 or badroad highway=pedestrian|bridleway then 10 else + if or maxspeed=20 or greyroad highway=bridleway then 20 else + if or maxspeed=30 or urbanc highway=track|road then 30 else + if or maxspeed=40 highway=unclassified then 40 else + if or maxspeed=50|urban or thirdc highway=unclassified then 50 else + if maxspeed=60 then 60 else + if or maxspeed=70 secondc then 70 else + if maxspeed=80 then 80 else + if or maxspeed=90|rural firstc then 90 else + if maxspeed=100 then 100 else + if or maxspeed=110 or trunkc eco then 110 else + if or maxspeed=120 ecofast then 120 else + if or maxspeed=130 motorwayc then 130 + else 30 + + +assign turncost if junction=roundabout then 0 else + multiply turn_penalty_multiplier + ( + if greater supposed_speed 90 then 0 else # motorways/trunks without sharp curves + if equal supposed_speed 90 then 320 else + if equal supposed_speed 80 then 240 else + if equal supposed_speed 70 then 180 else + if equal supposed_speed 60 then 125 else + if equal supposed_speed 50 then 80 else + if equal supposed_speed 40 then 50 else + if equal supposed_speed 30 then 27 else + if equal supposed_speed 20 then 11 else + if equal supposed_speed 10 then 3 + else 0 + ) + +assign initialclassifier +if route=ferry then 1 +else if highway=motorway then 2 +else if trunkc then 3 +else if firstc then 4 +else if secondc then 5 +else if thirdc then 6 +else if highway=unclassified then 7 +else if highway=residential then 8 +else if highway=living_street then 9 +else if highway=service then 10 +else if highway=motorway_link then 11 + else 12 + +assign initialcost switch route=ferry 20000 + +multiply initial_penalty_multiplier ( + +if highway=motorway then 0 +else if trunkc then 0 +else if firstc then 50 +else if secondc then 75 +else if thirdc then 100 +else if highway=unclassified then 125 +else if highway=residential then 150 +else if highway=living_street then 150 +else if highway=service then 150 +else if highway=motorway_link then 100 + else 200 + ) + +# +# calculate logical car access +# +assign caraccess + switch motorcar= + switch motor_vehicle= + switch vehicle= + switch access= + switch or highway=motorway highway=motorway_link 1 + switch or highway=trunk highway=trunk_link 1 + switch or highway=primary highway=primary_link 1 + switch or highway=secondary highway=secondary_link 1 + switch or highway=tertiary highway=tertiary_link 1 + switch highway=unclassified 1 + switch route=ferry 1 + switch or highway=residential highway=living_street 1 + switch highway=service 1 + 0 + or access=yes or access=permissive or access=designated access=destination + or vehicle=yes or vehicle=designated vehicle=destination + or motor_vehicle=yes or motor_vehicle=permissive or motor_vehicle=designated motor_vehicle=destination + or motorcar=yes or motorcar=permissive or motorcar=designated motorcar=destination + + +assign accesspenalty + switch caraccess + ( if ( and avoid_motorways ( or motorwayc motorroad=yes ) ) then 10000 + else if ( and avoid_toll toll=yes ) then 10000 + else if ( and ( or ( equal road_restriction 2 ) ( equal avoid_unpaved 1 ) ) + badroad ) then road_restriction_coef + else if ( and ( equal road_restriction 3 ) not ( or ismainroad urbanc ) ) then road_restriction_coef + else if ( and ( equal road_restriction 4 ) not ismainroad ) then road_restriction_coef + else if ( and ( equal road_restriction 5 ) not ismainroadsec ) then road_restriction_coef + else if ( and ( equal road_restriction 6 ) not ismainroadprm ) then road_restriction_coef + else 0 + ) + 10000 + +assign onewaypenalty + switch switch reversedirection=yes + switch oneway= + junction=roundabout + or oneway=yes or oneway=true oneway=1 + oneway=-1 + 10000 + 0.0 + + +assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link + + + + +assign costfactor + + add max onewaypenalty accesspenalty + switch and highway= not route=ferry 100000 + +#avoiding strange detours sometimes observed in OSMAnd native navigation +#related to implict/explicit speed limits, so links may appear faster. + + add switch islinktype 0.4 0 + + if route=ferry then 5.67 else + + if short then 1.0 # if someone insists on shortest route, what does not make much sense for cars + + else + multiply smoothness_penalty + ( + + if badroad then 30 else + if equal supposed_speed 10 then if eco then 2.49 else if ecofast then 5.81 else 13.0 else + if equal supposed_speed 20 then if eco then 1.57 else if ecofast then 3.07 else 6.50 else + if equal supposed_speed 30 then if eco then 1.18 else if ecofast then 2.12 else 4.33 else + if equal supposed_speed 40 then if eco then 1.07 else if ecofast then 1.69 else 3.25 else + if equal supposed_speed 50 then if eco then 1.03 else if ecofast then 1.44 else 2.60 else + if equal supposed_speed 60 then if eco then 1.02 else if ecofast then 1.28 else 2.17 else + if equal supposed_speed 70 then if eco then 1.00 else if ecofast then 1.16 else 1.86 else + if equal supposed_speed 80 then if eco then 1.00 else if ecofast then 1.08 else 1.63 else + if equal supposed_speed 90 then if eco then 1.01 else if ecofast then 1.02 else 1.44 else + if equal supposed_speed 100 then if eco then 1.05 else if ecofast then 1.00 else 1.30 else + if equal supposed_speed 110 then if eco then 1.17 else if ecofast then 1.02 else 1.18 else + if equal supposed_speed 120 then if eco then 1.29 else if ecofast then 1.05 else 1.08 else + if equal supposed_speed 130 then if eco then 1.40 else if ecofast then 1.08 else 1.00 else + 10000 + ) + +# odd priorities indicate link-types + +assign priorityclassifier = + + if ( highway=motorway ) then 30 + else if ( highway=motorway_link ) then 29 + else if ( highway=trunk ) then 28 + else if ( highway=trunk_link ) then 27 + else if ( highway=primary ) then 26 + else if ( highway=primary_link ) then 25 + else if ( highway=secondary ) then 24 + else if ( highway=secondary_link ) then 23 + else if ( highway=tertiary ) then 22 + else if ( highway=tertiary_link ) then 21 + else if ( highway=unclassified ) then 20 + else if ( highway=residential|living_street ) then 6 + else if ( highway=service ) then 6 + else if ( highway=track ) then if tracktype=grade1 then 4 else 2 + else if ( highway=bridleway|road ) then 2 + else 0 + +# some more classifying bits used for voice hint generation... + +assign isbadoneway = not equal onewaypenalty 0 +assign isgoodoneway = if reversedirection=yes then oneway=-1 + else if oneway= then junction=roundabout else oneway=yes|true|1 +assign isroundabout = junction=roundabout +assign isgoodforcars = if greater priorityclassifier 6 then true + else if highway=residential|living_street|service then true + else if ( and highway=track tracktype=grade1 ) then true + else false + +# ... encoded into a bitmask + +assign classifiermask add isbadoneway + add multiply isgoodoneway 2 + add multiply isroundabout 4 + add multiply islinktype 8 + multiply isgoodforcars 16 + + +---context:node # following code refers to node tags + +# +# calculate logical car access to nodes +# +assign caraccess + switch motorcar= + switch motor_vehicle= + switch vehicle= + switch access= + switch barrier=gate 0 + switch barrier=bollard 0 + switch barrier=lift_gate 0 + switch barrier=cycle_barrier 0 + switch and barrier=toll_booth avoid_toll 0 + switch and highway=toll_bridge avoid_toll 0 + 1 + or access=yes or access=permissive or access=designated access=destination + or vehicle=yes or vehicle=permissive or vehicle=designated vehicle=destination + or motor_vehicle=yes or motor_vehicle=permissive or motor_vehicle=designated motor_vehicle=destination + or motorcar=yes or motorcar=permissive or motorcar=designated motorcar=destination + +assign initialcost + switch caraccess + multiply node_penalty_multiplier + if highway=traffic_signals then 100 + else if highway=stop then 100 + else if highway=crossing then 50 + else if highway=bus_stop then 25 + else if or barrier=toll_booth highway=toll_bridge + then 1000 + else 0 + 1000000 + +#--------------------------------------------------------------------------------------------------------------- +# Legend +# costfactors are trivially 1.0 for shortest route +# For Fast route, they are reciprocal to chosen nominal or explicit speed, with 1.0 for 130 km/h, usual for EU motorways +# for Eco route, they are proportional to estimated specific fuel consumption, derived from http://www.mpgforspeed.com +# for FastEco, they are weighted from Eco and Fast +# +#================================================= +# original values from car-test profile +# switch or highway=motorway highway=motorway_link 1 +# switch or highway=trunk highway=trunk_link 1 +# switch or highway=primary highway=primary_link switch maxspeed=30 2.0 switch maxspeed=50 1.5 1.3 +# switch or highway=secondary highway=secondary_link 1.4 +# switch or highway=tertiary highway=tertiary_link 1.5 +# switch highway=unclassified 1.6 +# switch route=ferry 5.67 +# switch highway=bridleway 5 +# switch or highway=residential highway=living_street 2 +# switch highway=service 2 +# switch or highway=track or highway=road highway=path +# switch tracktype=grade1 5 +# switch ispaved 5 +# 30 +# 10000 +# +# costfactors are trivially 1.0 for shortest route +# For Fast route, they are reciprocal to chosen nominal or explicit speed, with 1.0 for 130 km/h, usual for EU motorways +# for Eco route, they are proportional to estimated specific fuel consumption, derived from http://www.mpgforspeed.com +# for FastEco, they are weighted from Eco and Fast +# +# Short Fast Eco FastEco +# kmph 0.7 +# 10 1.00 13.00 2.49 5.81 +# 15 1.00 8.67 1.90 3.99 +# 20 1.00 6.50 1.57 3.07 +# 25 1.00 5.20 1.34 2.50 +# 30 1.00 4.33 1.18 2.12 +# 40 1.00 3.25 1.07 1.69 +# 50 1.00 2.60 1.03 1.44 +# 60 1.00 2.17 1.02 1.28 +# 70 1.00 1.86 1.00 1.16 +# 80 1.00 1.63 1.00 1.08 +# 90 1.00 1.44 1.01 1.02 +# 100 1.00 1.30 1.05 1.00 +# 110 1.00 1.18 1.17 1.02 +# 120 1.00 1.08 1.29 1.05 +# 130 1.00 1.00 1.40 1.08 +# +#----------------------------------------------------------------------------------------------------------------------- +# Version history +#----------------------------------------------------------------------------------------------------------------------- +# V1.0.0: not initial version, due late start of the versioning +# V1.0.1: nodes: + added some distance penalties +# + involved penalty multiplier for start/stop events distance penalties, as being fuel hungry. +# ways: * tweaked initial costs and turncosts of ways +# + decreased motorway cruising speed to 110 km/h for eco modes, to avoid unnecessery penalties. +# V1.0.2: ways: * tweaked initial costs and turncosts +# V1.0.3: ways: * tweaked initial costs +# ways: + initial and turn penalty multipliers to achieve various effect for various profiles +# ways: * decresed link penalty +# V1.0.4: global: * tweaked uphillcost to 30, uphill/downhill cutoffs to 0.5 +# * code rearrangement +# V1.0.5 + added navigation instructions for Locus +# V1.0.6 * updated wrt recent navigation hint tweaks, ported part of car-test code +# * set to 1pass routing with pass1coefficient 1.3 +# V1.0.7 * global : added downloadcost ( downhill breaking ) +# * code rearrangement and clean up +# * way : simplified turn penalty +# V1.0.8 ! way : fixing caraccess and access penalty +# V1.0.9 + global+way : added flag main_and_urban, keeping car on mainroads and urban communications. +# V1.0.10 * way : tweaked turncost +# V1.0.11 * global : cancelled downhillcost +# V1.0.12 * all : backported changes from car-test, code rearrangement +# V1.0.13 + : main_only network switch + +# + : rearranged restriction code +# V1.0.14 * Implemented very long distance restrictions, ! small fixes +# V1.0.15 ALFA + Return to independent avoid_motorways - 13/5/16 +# + different pass1coefficients depending on allowsed motorways/toll roads - 13/5/16 +# V1.0.16 BETA * change of default to not avoiding unpaved, 7-aug-16 +# V1.0.17 !fixed bug marking highways=unclassified as forbidden for Car Fast profiles +# * costfactor tweaks for minor ways. 8-Aug-2016 +# V1.0.18 !revised initial and turning costs of roads ( modelling acceleration and delay effects in turns and initial speeding ups) +# + added boolen switched for beta Locus config screens - 18-aug-2016 +# V1.0.18 Modified flag parameter comment syntax for Locus, based on Arndt comment. 20-aug-2016 +# V1.0.19 !Fixed a bug in drivestyle logic 20-aug-2016 +# V1.0.20 Minor changes +# V1.0.21 fixing unpaved conditions for main roads +# V1.0.22 fixing fixed way initialcost +# V1.0.23 fixing assumed speeds for tracks + toll initialcost +# added smoothness \ No newline at end of file diff --git a/misc/profiles2/Hiking-Alpine-SAC6-private.brf b/misc/profiles2/Hiking-Alpine-SAC6-private.brf new file mode 100644 index 0000000..aa8737e --- /dev/null +++ b/misc/profiles2/Hiking-Alpine-SAC6-private.brf @@ -0,0 +1,485 @@ +# Walking-Hiking-Mountain/Alpine Hiking profile TEMPLATE +# 18/5/2016 v1.8.7 ! Fixed down/uphillcostfactors for shortest_way - to be really shortest +# +# SAC T6 - difficult_alpine_hiking - climbing up to second grade, Often very exposed, precarious jagged rocks, glacier with danger to slip and fall, Mature alpine experience, Familiarity with the handling of technical alpine equipment +# +# Legend above is placeholder for generated comments of final profile +# See the profile bottom for changelogs and verbose *) comments +# See also https://github.com/poutnikl/Brouter-profiles/wiki +# and https://github.com/poutnikl/Hiking-Poutnik + +---context:global + +assign consider_elevation 1 # 0 as default, otherwise less interesting flat roads are chosen. +assign shortest_way 0 # 0 as default, duplicate shortest standard profile, SAC access limit ignored for now + +assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style +assign turnInstructionCatchingRange 20 # V1.8.5 / default=40, but foot paths may be more distingushed, especially in cities. + +assign iswet 0 # 0 as default, 1 tries to prevent muddy boots and wet buttocks +assign hiking_routes_preference 0.20 # 0.10 as default, Increases cost of non hiking routes by multiplier 1 + hiking_routes_preference + +assign Offroad_factor 0.0 # default 0.0, see ****), see also https://github.com/poutnikl/Brouter-profiles/wiki/Trekking-MTB-Profiles---legend + +assign path_preference 0.0 # 0.0 as default, try 20.0 to penalize nonpath ways a/o paved ways + +#SAC - mountain hiking - see http://wiki.openstreetmap.org/wiki/Key:sac_scale + +assign SAC_scale_limit 6 # 0..6, 0 to avoid any SAC paths, 1 for T1 as maximum, 6 for T6 as maximum + # all paths with sac_scale higher than SAC_scale_limit are forbidden. +assign SAC_scale_preferred 4 # The same, but the preferred SAC scale level. Level below are slightly, above strongly penalized +assign SAC_access_penalty 9000 # costfactor 9999 means the most horrible but allowed road., + # 100000=forbidden. This makes difference if forbidden way is the only option. +assign SAC_K1 0.05 # Penalizing of SAC levels below preferred +assign SAC_K2 0.6 # Penalizing of SAC levels above preferred + +#orientation/decision penalties, not used for preferred hiking routes +assign turncost_value 0 # not used now +assign initialcost_value 0 # not used now + +#less frequently changed flags +assign allow_steps 1 # 1 as default +assign allow_ferries 1 # 1 as default +assign cost_of_unknown 2 # 2 as default +# +assign elevationpenaltybuffer 5 # 5 as default +assign elevationmaxbuffer 10 # 10 as default +assign elevationbufferreduce 1.0 # 0.0 as default + +# as initial point, considered flat speed 4 km/h, climbing speed 600 m /h +assign uphillcostvalue 7 +assign uphillcutoffvalue 3 +assign downhillcutoffvalue 3 +assign downhillcostvalue 7 + +#internal parameters +assign Offroad_hillcostfactor multiply -0.3333 ( max -3.0 ( multiply -1.0 ( max 0.0 Offroad_factor ) ) ) + # for Offroadfactor <=0 is 0, for Offroadfactor >=3 is 1, otherwise 0.3333 * Offroadfactor + # progressively decreases hillcosts to be 0.0 at Offroad_factor = 3.0 + # if Offroad_factor = 1 , then downhillcost decreases e.g. from 60 to 40 + +assign downhillcost if consider_elevation then + ( multiply ( add 1.0 ( multiply Offroad_hillcostfactor -1.0 ) ) downhillcostvalue ) else 0 + +assign uphillcost if consider_elevation then + ( multiply ( add 1.0 ( multiply Offroad_hillcostfactor -1.0 ) ) uphillcostvalue ) else 0 + +assign uphillcutoff if consider_elevation then uphillcutoffvalue else 1.5 +assign downhillcutoff if consider_elevation then downhillcutoffvalue else 1.5 + +assign nonhiking_route_penalty add 1.0 max 0.0 hiking_routes_preference + +assign validForFoot 1 + +#Penalizing SAC routes below (K1) and above(K2) preferred SAC scale +#see http://wiki.openstreetmap.org/wiki/Key:sac_scale + +#SAC_scale_penalty: +#Penalty is SAC_access_penalty for SAC > SAC_scale_limit +#Penalty is 0.0 for SAC_scale_preferred = SAC, SAC <= SAC_scale_limit +#Penalty is ( 1 + SAC_K1)^(SAC_scale_preferred - SAC) -1 for SAC_scale_preferred > SAC, SAC <= SAC_scale_limit +#Penalty is ( 1 + SAC_K2)^(SAC - SAC_scale_preferred) -1 for SAC_scale_preferred < SAC, SAC <= SAC_scale_limit + +#extra complexity of code below, with adding +/- 1.0 +#is to keep final penalties additive, even with multiplicative incremental penalty approach +#code is run only once, being in global context + +assign SAC_K10 add SAC_K1 1.0 +assign SAC_K20 add SAC_K2 1.0 + +assign SAC_K1_2 add multiply SAC_K10 SAC_K10 -1.0 +assign SAC_K2_2 add multiply SAC_K20 SAC_K20 -1.0 + +assign SAC_K1_3 add ( multiply ( add SAC_K1_2 1.0 ) SAC_K10 ) -1.0 +assign SAC_K2_3 add ( multiply ( add SAC_K2_2 1.0 ) SAC_K20 ) -1.0 +assign SAC_K1_4 add ( multiply ( add SAC_K1_3 1.0 ) SAC_K10 ) -1.0 +assign SAC_K2_4 add ( multiply ( add SAC_K2_3 1.0 ) SAC_K20 ) -1.0 +assign SAC_K1_5 add ( multiply ( add SAC_K1_4 1.0 ) SAC_K10 ) -1.0 +assign SAC_K2_5 add ( multiply ( add SAC_K2_4 1.0 ) SAC_K20 ) -1.0 +assign SAC_K1_6 add ( multiply ( add SAC_K1_5 1.0 ) SAC_K10 ) -1.0 +assign SAC_K2_6 add ( multiply ( add SAC_K2_5 1.0 ) SAC_K20 ) -1.0 + + +---context:way # following code refers to way-tags + +assign ispaved or surface=paved or surface=asphalt or surface=concrete surface=paving_stones +assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone + +assign any_hiking_route or route=hiking or route_hiking_iwn=yes + or route_hiking_nwn=yes or route_hiking_rwn=yes + or route_hiking_lwn=yes or route_hiking_=yes + or route_foot_=yes or route_foot_nwn=yes + or route_foot_rwn=yes route_foot_lwn=yes + +assign any_cycleroute = + if route_bicycle_icn=yes then true + else if route_bicycle_ncn=yes then true + else if route_bicycle_rcn=yes then true + else if route_bicycle_lcn=yes then true + else false + +assign is_ldhr and any_hiking_route not equal 0.0 hiking_routes_preference +assign nodeaccessgranted any_hiking_route + +# ismuddy addresses potentially bad surface conditions during wet weather ( mud, slickiness of grass) +assign ismuddy and or isunpaved surface= + and iswet + not or surface=gravel surface=pebblestone + +assign issidewalk sidewalk=left|right|both|yes + +assign istrack highway=track|road|path|footway +assign ismainroad highway=motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified + +#assign turncost switch or shortest_way is_ldhr 0 turncost_value #v1.5 +assign turncost 0 #v1.8.3 + +assign initialcost + switch route=ferry 10000 + + switch or shortest_way is_ldhr 0 initialcost_value + +assign defaultaccess switch access= not motorroad=yes switch or access=private access=no 0 1 + +assign bikeaccess + or any_cycleroute + switch bicycle= + switch vehicle= + defaultaccess + switch or vehicle=private vehicle=no + 0 + 1 + not or bicycle=private or bicycle=no bicycle=dismount + +assign footaccess or any_hiking_route + or issidewalk + or and bikeaccess not foot=no + or bicycle=dismount + switch foot= defaultaccess not foot=private|no + +assign accesspenalty switch footaccess 0 switch bikeaccess 4 100000 + +assign badoneway = 0 +assign onewaypenalty = 0 + + +#SAC is estimated path difficulty, +#integrating both MTB and SAC scales with estimated MTB/SAC difficulty matching +#see http://wiki.openstreetmap.org/wiki/Key:mtb:scale +# http://wiki.openstreetmap.org/wiki/Key:sac_scale + +assign SAC + if sac_scale= then ( + + if mtb:scale= then 0 + + else if mtb:scale=6|5 then 5 + else if mtb:scale=4 then 4 + else if mtb:scale=3 then 3 + else if mtb:scale=2-|2|2+ then 2 + else if mtb:scale=1+|1 then 1 + else 0 + ) + else + + if sac_scale=difficult_alpine_hiking then 6 + else if sac_scale=demanding_alpine_hiking then 5 + else if sac_scale=alpine_hiking then 4 + else if sac_scale=demanding_mountain_hiking then 3 + else if sac_scale=mountain_hiking then 2 + else if sac_scale=hiking|T1-hiking|yes then 1 + else 0 + +assign SAC_scale_access # if SAC_scale_limit < SAC then true else false + if sac_scale= then true else equal ( max SAC_scale_limit SAC ) SAC_scale_limit + +assign SAC_scale_penalty + + if not SAC_scale_access then SAC_access_penalty # not allowed SAC scale + + else if equal SAC SAC_scale_preferred then 0.0 + else if equal ( add SAC 1 ) SAC_scale_preferred then SAC_K1 + else if equal ( add SAC 2 ) SAC_scale_preferred then SAC_K1_2 + else if equal ( add SAC 3 ) SAC_scale_preferred then SAC_K1_3 + else if equal ( add SAC 4 ) SAC_scale_preferred then SAC_K1_4 + else if equal ( add SAC 5 ) SAC_scale_preferred then SAC_K1_5 + else if equal ( add SAC 6 ) SAC_scale_preferred then SAC_K1_6 + else if equal ( add SAC_scale_preferred 1 ) SAC then SAC_K2 + else if equal ( add SAC_scale_preferred 2 ) SAC then SAC_K2_2 + else if equal ( add SAC_scale_preferred 3 ) SAC then SAC_K2_3 + else if equal ( add SAC_scale_preferred 4 ) SAC then SAC_K2_4 + else if equal ( add SAC_scale_preferred 5 ) SAC then SAC_K2_5 + else if equal ( add SAC_scale_preferred 6 ) SAC then SAC_K2_6 + else 1.0 + +assign tracktype_penalty ( + if not istrack then 0.0 else if tracktype= then 0.0 + else if tracktype=grade1 then 0.1 else if tracktype=grade2 then 0.05 + else if tracktype=grade3 then 0.0 else if tracktype=grade4 then 0.0 + else if tracktype=grade5 then 0.0 else 0.0 ) + +assign surface_penalty ( + if not istrack then 0.0 + else if ispaved then 0.0 + else if surface=cobblestone then 0.0 + else if surface=fine_gravel|ground|earth|unpaved|grass|compacted then 0.0 + else if surface=dirt|sand then 0.1 + else if surface= then 0.0 + else if surface=gravel|pebblestone then 0.2 + else 0.0 ) + +assign wet_penalty ( + if not iswet then 0.0 + else if ismainroad then -0.1 + else if tracktype=grade1 then ( if ispaved then -0.2 else if ismuddy then 0.2 else 0.1 ) + else if tracktype=grade2 then ( if ispaved then -0.1 else if ismuddy then 0.4 else 0.2 ) + else if tracktype=grade3 then ( if ispaved then -0.0 else if ismuddy then 0.8 else 0.3 ) + else if tracktype=grade4 then ( if ispaved then 0.1 else if ismuddy then 1.5 else 0.5 ) + else if tracktype=grade5 then ( if ispaved then 0.2 else if ismuddy then 2.5 else 1.0 ) + else ( if ispaved then -0.2 else if ismuddy then 2.5 else 1.0 ) + ) + +assign Offroad_factor_for_road + if ( equal Offroad_factor 0.0 ) then 0.0 else + ( + if ismainroad then Offroad_factor + else if ( or ispaved highway=residential|living_street|service|pedestrian ) then ( multiply 0.33 Offroad_factor ) + else if ( not isunpaved ) then ( multiply -0.33 Offroad_factor ) + else ( multiply -1 multiply Offroad_factor ( add 1.0 ( multiply 0.33 SAC_scale_penalty ) ) ) + ) + +assign nonpath_penalty = +if ( equal path_preference 0.0 ) then 0.0 # nonpath_penalty inactive +else if not istrack then path_preference #istrack = highway=track/path/road/footway +else if ispaved then ( multiply path_preference 0.5 ) +else if or ( and not isunpaved not highway=path ) + ( tracktype=grade1|grade2 ) then ( multiply path_preference 0.25 ) +else if not ( and isunpaved + and highway=path + and tracktype=grade1|grade2 + not surface=gravel|cobblestone|pebblestone ) + then ( multiply path_preference 0.125 ) +else 0.0 + +assign rawcostfactor # can be <1.0, is treated later + + if shortest_way then ( add 1 accesspenalty ) else + + add nonpath_penalty + add accesspenalty + ( + if ( and highway= not route=ferry ) then 100000 + else if highway=steps then ( switch allow_steps ( switch consider_elevation 1.0 3.0 ) 100000 ) + else if route=ferry then ( if allow_ferries then 2.34 else 100000 ) + +# iswet=1 in global context section means wet weather, increases penalty for eventually inconvenient ways +# ismuddy boolean relates in wet weather to unpaved or unclassified surface, that can have mud or get slicky in wet weather. + + else if highway=pedestrian then ( switch ismuddy 1.3 1.0 ) + else if highway=bridleway then ( switch ismuddy 2.5 switch iswet 1.4 1.2 ) + else if highway=cycleway then ( switch ismuddy 1.4 switch iswet 1.0 1.1 ) + else if highway=residential|living_street + then ( switch ismuddy 1.5 switch iswet 1.0 1.1 ) + else if highway=service then ( switch ismuddy 1.5 switch iswet 1.1 1.2 ) + + else if istrack then + ( add 1.0 add tracktype_penalty add surface_penalty add wet_penalty SAC_scale_penalty ) + + else if highway=motorway|motorway_link then 100000 + else if highway=proposed|abandoned|construction then ( switch ismuddy 10 switch iswet 6 4 ) + + else if highway=trunk|trunk_link then + ( switch iswet ( switch issidewalk 1.5 10 ) ( switch issidewalk 2.0 20 ) ) + else if highway=primary|primary_link then + ( switch iswet ( switch issidewalk 1.5 5 ) ( switch issidewalk 2.0 10 ) ) + else if highway=secondary|secondary_link then + ( switch iswet ( switch issidewalk 1.2 2.5 ) ( switch issidewalk 1.5 4.0 ) ) + else if highway=tertiary|tertiary_link then + ( if iswet then ( switch issidewalk 1.1 1.5 ) else ( switch issidewalk 1.2 2.5 ) ) + else if highway=unclassified then + ( if ismuddy then 3.0 else if iswet then ( switch issidewalk 1.0 1.3 ) else ( switch issidewalk 1.1 1.5 ) ) + + else add cost_of_unknown switch ismuddy 0.5 0.0 + ) + +assign rawcostfactor2 + + if equal hiking_routes_preference 0.0 then rawcostfactor # Not preferring hiking routes + else if is_ldhr then rawcostfactor # is hiking route + else multiply rawcostfactor nonhiking_route_penalty + +assign costfactor if shortest_way then ( add 1 accesspenalty ) + else max 1.0 add rawcostfactor2 Offroad_factor_for_road + +assign downhillcostfactor + if shortest_way then ( add 1 accesspenalty ) else + max 1.0 + add rawcostfactor2 + add Offroad_factor_for_road + if ismuddy then 0.5 # slicky + else if surface=grass then -0.2 # soft impact + else if ispaved then 0.2 # hard impact + else if surface=gravel|pebblestone|fine_gravel then 0.3 # slides + else 0.0 + +assign uphillcostfactor + if shortest_way then ( add 1 accesspenalty ) else + max 1.0 + add rawcostfactor2 + add Offroad_factor_for_road + if ismuddy then 0.3 # slicky + else if surface=grass then 0.1 # unsure foot + else if ispaved then -0.1 # sure foot + else if surface=gravel|pebblestone|fine_gravel then 0.2 # slides + else 0.0 + +# way priorities used for voice hint generation + +assign priorityclassifier = + + if ( highway=motorway ) then 30 + else if ( highway=motorway_link ) then 29 + else if ( highway=trunk ) then 28 + else if ( highway=trunk_link ) then 27 + else if ( highway=primary ) then 26 + else if ( highway=primary_link ) then 25 + else if ( highway=secondary ) then 24 + else if ( highway=secondary_link ) then 23 + else if ( highway=tertiary ) then 22 + else if ( highway=tertiary_link ) then 21 + else if ( highway=unclassified ) then 20 + else if ( highway=residential|living_street ) then 18 + else if ( highway=steps|pedestrian ) then 16 + else if ( highway=service|cycleway ) then if ( or tracktype=grade1 ispaved ) then 14 else 12 + else if ( highway=track|road|bridleway ) then if ( or tracktype=grade1 ispaved ) then 10 else 8 + else if ( highway=path|footway ) then ( if ( or tracktype=grade1 ispaved ) then 6 + else if tracktype=grade2 then 4 + else if not surface=grass|gravel then 3 + else 2 ) + else 0 + +# some more classifying bits used for voice hint generation... + +assign isbadoneway = 0 +assign isgoodoneway = 0 +assign isroundabout = junction=roundabout +assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link +assign isgoodforcars = if greater priorityclassifier 19 then true + else if highway=residential|living_street|service then true + else if ( and highway=track tracktype=grade1 ) then true + else false + +# ... encoded into a bitmask + +assign classifiermask add isbadoneway + add multiply isgoodoneway 2 + add multiply isroundabout 4 + add multiply islinktype 8 + multiply isgoodforcars 16 + +---context:node # following code refers to node tags + + +assign defaultaccess + switch access= + 1 # add default barrier restrictions here! + switch or access=private access=no + 0 + 1 + +assign bikeaccess + or nodeaccessgranted=yes + switch bicycle= + switch vehicle= + defaultaccess + switch or vehicle=private vehicle=no + 0 + 1 + switch or bicycle=private or bicycle=no bicycle=dismount + 0 + 1 + +assign footaccess + or bicycle=dismount + switch foot= + defaultaccess + switch or foot=private foot=no + 0 + 1 + +assign initialcost switch or bikeaccess footaccess 0 1000000 + +############################################################################################# +# ****) Offroad_factor ( ported MTB_factor from bicycle Trekking profile +############################################################################################# +# +# MTB_factor tweaks/trims MTB approach of the profile by preferring/penalizing in progressive order +# nonpaved - preferred +# not paved - little preferred +# paved - little penalized +# mainroads - penalized +# +# MTB_factor can be used for one-time tweaking of routing profile for particular trip, +# or trimming of the profile according to biker preferencing without need of profile deep insight +# +# Positive values progessively promote/penalize roads in favour of MTB riding. + +# Negative value has the opposite effect, preferring mainroads and penalizing unpaved roads. +# This effect is somewhat similar to iswet=1 ( *) wet weather mode ), +# but does not distinguish particular road classes / surfaces / smoothness, +# aside of mentioned schema below. + +# The calculated values below is added to the costfactor. + +# + MTB_factor for main roads (tertiaries and better), +# + 0.33 * MTB_factor for paved roads, +# - 0.33 * MTB_factor for not paved/not unpaved roads, +# - MTB_factor * ( 1 + 0.33 * smoothnesspenalty ) for unpaved roads. - at MTB_factor 3.0 smootheness is ignored +# +# Default is 0.0 = no effect. +# Recommended -0.5 - +1.0 +# Reasonable -2.0 .. +3.0, +# +# Final costfactor is kept >= 1 for final costfacto values. +############################################################################################# +# changelog: +# Feature is / + added / - removed / * changed / ! fixed + +# Hiking Version 1.6 ALFA +# 2014-10-10 (c) Poutnik +# Route_foot related hints were improved with usage of Hiking.brf from below and by Arndt comment +# http://pastebin.com/YLpkGVD4 +# http://forum.openstreetmap.org/viewtopic.php?pid=447507#p447507 +# +# 2014-10-10 v1.1 - changed hiking route preference logic +# 1.2 - fixed preference counting bug +# 2014-10-11 1.3 - adding foot route to hiking routes, +# fixed ferry cost to respect initial cost triggerring. +# added bikeaccess, added shortest way mode, code cleanup +# 2014-10-12: v1.4 - involving turncosts and way/node initial costs as orientation/decision penalties, +# but turning them off for sticking to hiking routes as extra preference, +# tweaking cost preferences +# 2014-10-13 v1.5 +# redesigned route preference policy - turncost turned off even for nonsticky but preferred hiking routes +# cost tweaking. +# removed uniform cost=1 for sticky hiking routes, to distinguish quality +# giving penalty 1 for non hiking routes at sticky hiking routes. +# used not round costs to often trigger initial cost calculation +#v1.51 - bugfix of redundant routing penalty +#v 1.6 - initialcost penalty only for sticking routes, decreased way penalties for preferring routes +# 31/5/2015 v 1.7 ALFA + sac_scale + sac_scale_limit implemented +# 10/6/2015 v1.7.1 ALFA * sac_scale improved +# + MTB scale integrated to SAC scale +# + sac_scale_preferred implemented, with progressive penalizing for SAC <> SAC preferred +# 10/6/2015 v1.7.2 BETA ! Fixed general way access penalties +# 15/6/2015 v1.7.3 BETA * SAC-MTB scale integration reevaluated, increased MTB scale penalty +# * MTB scale penalty used as fallback if no SAC rating +# 16/6/2015 v1.7.4 ALFA * Optimized SAC logic +# 17/6/2015 v1.7.5 BETA + Track penalty system +# 20/6/2015 v1.7.6 RELEASE * Modified and simplified route preferencing +# 01/12/2015 v1.8.1 ALFA +ported MTB_factor from bicycle Trekking template, renamed for hiking context to Offroad_factor +# 02/4/2016 v1.8.2 ALFA +implemented path preference factor , try 20.0. Default 0.0 has no effect +# 3/5/2016 v1.8.3 BETA +implemented navigation hint support +# 7/5/2016 v1.8.4 RELEASE +implemented navigation hint support ftom BRouter 1.4 +# 10/5/2016 v1.8.6 BETA * decreased turnInstructionCatchingRange from default 40 to 20 +# 18/5/2016 v1.8.7 BETA ! Fixed down/uphillcostfactors for shortest_way - to be really shortest diff --git a/misc/profiles2/MTB-private.brf b/misc/profiles2/MTB-private.brf new file mode 100644 index 0000000..d532a9c --- /dev/null +++ b/misc/profiles2/MTB-private.brf @@ -0,0 +1,562 @@ +# Poutnik's Trekking profile template for Trekking profile variants +# Version 2.6.* new max cost system +# +# *) = See also https://github.com/poutnikl/Brouter-profiles/wiki +# **) = See also https://github.com/poutnikl/Trekking-Poutnik/wiki +# +# MTB profile, based on MTBiker feedback +# +# Legend above is the placeholder for generated comments of final profiles +# See the HistoryLog.txt file for file history, the wikis above for verbose comments. + +# bstart /global +---context:global +assign iswet 0 # 0 as default, *) flag for weather conditions +assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style +assign cycleroutes_pref 0.2 # also CRP *) costfactor penalty for not being cycleroute +assign MTB_factor 2.0 # default 0.0, *) +assign smallpaved_factor -0.5 # default 0.0, *) +assign avoid_unsafe 0 # 0 as default, gives penalty to mainroad without bike friendly status. +assign hills 1 # 1=default / 0=BRouter default/ 1=+ penalty for uphills >3.0%/ 2=velomobile-like avoiding slopes, 3= simulates ascend/length time equiv. + # 4=valley mode, 5=No-Flats mode +assign isbike_for_mainroads true # default=true / if false then bike friendly tag hints for mainroads are ignored, keeping their high penalties. v2.5.20 +assign path_preference 0.0 # 0.0 as default, try 20.0 to penalize nonpath ways a/o paved ways + +assign consider_elevation 1 # 1 as default +assign consider_smoothness 1 # 1 as default +assign allow_steps 1 # 1 as default +assign allow_ferries 1 # 1 as default +assign allow_traffic_penalty 1 # 1 as default + +assign StrictNOBicycleaccess 0 # 0 allows but penalizes foot only access / 1 forbides foot only access. +assign valley_nonflat_multiplier = 2.0 + +assign allow_default_barrier_restriction false # If true, default access for barrier=gate is false. see node context + +# Internal parameters - not intended to be tweaked by end users, unless they know what they are doing. + +#new in 2.5.12 + +assign NoFlatMode equal hills 5 +assign ValleyMode equal hills 4 +assign originalisbike false + +assign uphillcostvalue switch equal hills 1 70 switch equal hills 2 80 + switch equal hills 3 60 switch ValleyMode 150 switch NoFlatMode 0 0 +assign uphillcutoffvalue switch equal hills 1 3.0 switch equal hills 2 1.0 + switch equal hills 3 0.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 +assign downhillcutoffvalue switch equal hills 1 1.5 switch equal hills 2 0.5 + switch equal hills 3 1.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 +assign downhillcostvalue switch equal hills 1 60 switch equal hills 2 80 + switch equal hills 3 0 switch ValleyMode 150 switch NoFlatMode 0 0 + +assign Flat_Penalty if NoFlatMode then 1.5 else 0.0 + +assign validForBikes 1 +assign processUnusedTags 0 # 1 is old Brouter behaviour, 0 is new Brouter default, more efficient, but ignores tags not used by a profile. + + +# positive smallpaved factor effect subtracts itself from MTB factor effect +# on MTB-like OSM way preference and elevation effect attenuation + +#v2.5.14 assign MTBminusSP_factor sub MTB_factor ( max 0 smallpaved_factor ) - pre v2.5.14 + +#v2.5.14 +assign Hill_factor min 3 max -3 sub MTB_factor smallpaved_factor +assign Road_factor min 3 max -3 ( sub ( sub 0.0 MTB_factor ) smallpaved_factor ) + +assign positive_smallpaved_factor not lesser smallpaved_factor 0.0 +assign abs_smallpaved_factor multiply ( switch positive_smallpaved_factor 1.0 -1.0 ) smallpaved_factor + +assign MTB_hillcostfactor multiply 0.3333 Hill_factor + # It changes hillcosts to be 0.0 at Hill_factor = 3.0 and twice at -3.0 + # Hill_factor 1..-1 leads hillcost to decrease e.g. from 60 to 40 / increase from 60 to 80 + +assign downhillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) downhillcostvalue ) else 0 +assign uphillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) uphillcostvalue ) else 0 +assign uphillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) uphillcutoffvalue ) else 1.5 +assign downhillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) downhillcutoffvalue ) else 1.5 + +assign elevationpenaltybuffer if ValleyMode then 10 else 5 # 5 is trekking default +assign elevationmaxbuffer if ValleyMode then 20 else 10 # 10 is trekking default +assign elevationbufferreduce if ValleyMode then 0.0 else ( multiply 0.333 max uphillcutoff downhillcutoff ) # 0.0 is trekking default + +assign uphillCFshift 0.0 # experimental shifting of up/downhillcostfactors as alternative way of +assign downhillCFshift 0.0 # prioritizing/penalizing of up/downhills, based on length, not elevation + +assign pass1coefficient 1.8 +assign pass2coefficient 0 + +assign use_proposed_cn 1 # 0 as default, considers proposed cycle networks as unmarked but valid cycleroutes. +assign considerTurnRestrictions = true #v2.5.11 + +assign unsafe_penalty_value 1.0 # 1 - was 2 in Trekking, but this may cause U-like safe routes +assign cost_of_unknown 2.0 # 2 as default, cost of highway= + +assign c_ford_initialcost_node = 500 +assign c_ford_initialcost_way = 1000 +assign c_ford_costfactor = 50 +assign million = 1000000 + +assign ford_handling_coef + switch ( lesser Hill_factor -1.49 ) million switch ( lesser Hill_factor -0.99 ) 20 + switch ( lesser Hill_factor -0.49 ) 5.0 switch ( lesser Hill_factor 0.01 ) 1.0 + switch ( lesser Hill_factor 0.51 ) 0.4 switch ( lesser Hill_factor 1.01 ) 0.1 + switch ( lesser Hill_factor 1.51 ) 0.05 0.0 + +assign ford_initialcost_way = if ( equal ford_handling_coef million ) then million else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_initialcost_way ford_handling_coef + +assign ford_initialcost_node = if ( equal ford_handling_coef million ) then million else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_initialcost_node ford_handling_coef + +assign ford_costfactor = if ( equal ford_handling_coef million ) then 9999 else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_costfactor ford_handling_coef + +assign UDcostON true + +assign ncncoef max 0 min 1 multiply cycleroutes_pref 0.2 +assign lcncoef max 0 min 1 multiply cycleroutes_pref 1.0 + +# bend /global +# bstart /way +---context:way # following code refers to way-tags +# bstart /wayvariables +assign isicn route_bicycle_icn=yes +assign isncn or route_bicycle_ncn=yes ncn=yes +assign isrcn or route_bicycle_rcn=yes rcn=yes +assign islcn or route_bicycle_lcn=yes lcn=yes + +assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes + +assign any_cn_yes or lcn=yes or rcn=yes ncn=yes +assign any_cn_proposed or lcn=proposed or rcn=proposed ncn=proposed +assign any_cn or any_cn_yes switch use_proposed_cn any_cn_proposed 0 + +assign nodeaccessgranted or any_cycleroute any_cn + +assign is_ldcr if ( equal cycleroutes_pref 0.0 ) then false else nodeaccessgranted + +assign istrack highway=track|road|path|footway +assign ismainroad highway=motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified +assign isotherroad = not or istrack ismainroad + +assign hascycleway = not + and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) ( or cycleway:right= cycleway:right=no ) + +#2.6.* inserted originalisbike option +assign isbike_candidate or bicycle=yes|permissive|designated or hascycleway + if originalisbike then lcn=yes else nodeaccessgranted + +assign isbike and ( or ( not ismainroad ) isbike_for_mainroads ) isbike_candidate + + +assign ispaved surface=paved|asphalt|concrete|paving_stones +assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone + +assign probablyGood or ispaved and isbike not isunpaved #probably good surface - weather independent + +assign turncost if ismainroad then 90 else if ispaved then 60 else 30 +# Turn cost is based solely on estimation of road speediness and eventual time cost of turning, partially promoting tracks ) + +assign ismuddy and iswet + and ( not surface=gravel|pebblestone ) # ***) + ( or isunpaved ( and surface= and highway=track|path not tracktype=grade1 ) ) + +assign nosurface or surface= surface=unknown +assign nosurfacenortracktype and nosurface tracktype= +assign ishard or ispaved surface=cobblestone|sett|compacted|fine_gravel|gravel|pebblestone +assign issoft not or nosurface ishard + +# bend /wayvariables + + +# bstart /initialcost +assign initialclassifier +if route=ferry then 1 +else if ( ford=yes ) then 15 +else if ( highway=motorway|motorway_link ) then 2 +else if ( highway=trunk|trunk_link ) then 3 +else if ( highway=primary|primary_link ) then 4 +else if ( highway=secondary|secondary_link ) then 5 +else if ( highway=tertiary|tertiary_link ) then 6 +else if ( highway=unclassified ) then 7 +else if ( highway=residential ) then 8 +else if ( highway=living_street ) then 9 +else if ( highway=service ) then 10 +else if ( highway=footway ) then 11 +else if ( istrack ) then 12 +else if ( highway=cycleway ) then 13 + else 14 + +assign initialcost +if route=ferry then 10000 +else if ( ford=yes ) then ford_initialcost_way +else if ( highway=motorway|motorway_link|trunk|trunk_link ) then 500 +else if ( highway=primary|primary_link ) then 120 +else if ( highway=secondary|secondary_link ) then 80 +else if ( highway=tertiary|tertiary_link|unclassified ) then 50 +else 30 + +# bend /initialcost + +# bstart /wayaccess + +assign defaultaccess = + if access= then not motorroad=yes + else if access=private|no then false + else true + +assign bikeaccess = + if nodeaccessgranted then true + else if hascycleway then true + else if bicycle= then ( if vehicle= then defaultaccess else not vehicle=private|no ) + else not bicycle=private|no|dismount + +assign footaccess = + if bikeaccess then true + else if bicycle=dismount then true + else if foot= then defaultaccess + else not foot=private|no + +assign accesspenalty = + if bikeaccess then 0 + else if footaccess then + ( if StrictNOBicycleaccess then 10000 else 4 ) + else 10000 + +# handle one-ways. On primary roads, wrong-oneways should be close to forbidden +# while on other ways we just add 4 to the costfactor +# making it at least 5, as you are allowed to push your bike. + +assign badoneway = + if reversedirection=yes then + if oneway:bicycle=yes then true + else if oneway= then junction=roundabout + else oneway=yes|true|1 + else oneway=-1 + +assign onewaypenalty = + if ( badoneway ) then + if cycleway=opposite|opposite_lane|opposite_track then 0 + else if oneway:bicycle=no then 0 + else if highway=primary|primary_link then 50 + else if highway=secondary|secondary_link then 30 + else if highway=tertiary|tertiary_link then 20 + else 4.0 + + else 0.0 + +# bend /wayaccess + +# bstart /roadmaxpenalties + +# bstart /roughness_penalty +assign smoothness_penalty +# http://wiki.openstreetmap.org/wiki/Key:smoothness + +if not consider_smoothness then 0.0 else +if smoothness= then 0.0 else +if smoothness=excellent|very_good|good then 0.0 else +if smoothness=intermediate then 0.2 else +if smoothness=bad|robust_wheels then 0.5 else +if smoothness=very_bad|high_clearance then 1.2 else +if smoothness=horrible|off_road_wheels then 2.5 else +if smoothness=very_horrible then 5.0 else +if smoothness=impassable then 10.0 else +0.0 + +assign mtb_scale_penalty if not consider_smoothness then 0.0 else + +# Remember this is for trekking bikes, not MTB. There are MTB dedicated profiles. +# http://wiki.openstreetmap.org/wiki/Key:mtb:scale + +if mtb:scale= then 0.0 else if mtb:scale=0- then 0.0 else +if mtb:scale=0 then 0.0 else if mtb:scale=0+ then 0.3 else +if mtb:scale=1- then 0.7 else if mtb:scale=1 then 1.2 else +if mtb:scale=1+ then 1.8 else if mtb:scale=2- then 2.5 else +if mtb:scale=2 then 5.0 else if mtb:scale=2+ then 10.0 else +if mtb:scale=3 then 15.0 else +if mtb:scale=4|5|6 then 9000 + else 0.0 + +assign roughness_penalty max smoothness_penalty max mtb_scale_penalty ( if ford=yes then ford_costfactor else 0 ) + +# bend /roughness_penalty + +# bstart /MTB_SP_tweaks + +assign rough_coef = add 1.0 ( multiply 0.33 roughness_penalty ) + +assign univ_factor_coef + switch highway=motorway|motorway_link|trunk|trunk_link 1.0 switch highway=primary|primary_link 0.9 + switch highway=secondary|secondary_link 0.7 switch highway=tertiary|tertiary_link 0.4 + switch highway=unclassified 0.25 + switch or not istrack highway=footway ( switch ispaved 0.25 switch isunpaved -0.25 0.0 ) + switch or ispaved tracktype=grade1 0.1 + multiply rough_coef + add ( switch highway=path -0.25 0.0 ) + switch ( nosurfacenortracktype ) ( switch isbike 0.0 -0.25 ) + switch nosurface ( switch or isbike tracktype=grade2|grade3 -0.25 -0.5 ) + switch surface=compacted|fine_gravel -0.25 switch surface=cobblestone|sett -0.4 + switch surface=ground|mud|dirt -0.6 switch surface=grass|sand -0.6 + switch surface=gravel|pebblestone -0.75 -0.6 + +assign nonpath_penalty = + if equal path_preference 0.0 then 0.0 # nonpath_penalty inactive + else multiply ( max 0 path_preference ) + if ismainroad then 1 else if not or istrack highway=cycleway then 0.6 + else if ispaved then 0.4 else if or not highway=path or not isunpaved tracktype=grade1|grade2 then 0.25 + else if or not isunpaved or not highway=path or not tracktype=grade3|grade4|grade5 + surface=gravel|cobblestone|pebblestone then 0.15 else 0.0 + +assign MTB_factor_for_road if ( equal MTB_factor 0.0 ) then 0.0 else multiply MTB_factor univ_factor_coef +assign abs_univ_factor if lesser univ_factor_coef 0.0 then multiply -1.0 univ_factor_coef else univ_factor_coef +assign smallpaved_factor_for_road if ( equal smallpaved_factor 0.0 ) then 0.0 + else multiply abs_smallpaved_factor ( if positive_smallpaved_factor then abs_univ_factor else ( sub 1.0 abs_univ_factor ) ) +# bend /MTB_SP_tweaks + +# bstart /HWclass_bfactor_components + +assign highwayclass_basefactor + if ismainroad then + switch highway=trunk|trunk_link 1.8 switch highway=primary|primary_link 1.5 + switch highway=secondary|secondary_link 1.2 switch highway=tertiary|tertiary_link 1.1 1.0 + else if istrack then + switch highway=track 1.0 switch highway=path 1.1 switch highway=footway 1.2 1.0 # highway=road + else + switch highway=pedestrian 2.0 switch highway=bridleway 3.0 + switch highway=cycleway 1.0 switch highway=residential|living_street 1.0 + switch highway=service 1.1 cost_of_unknown + + +assign tracktype_penalty + if tracktype= then 0.0 else + switch tracktype=grade1 0.0 switch tracktype=grade2 0.4 switch tracktype=grade3 0.7 + switch tracktype=grade4 0.9 switch tracktype=grade5 1.0 0.5 + +assign surface_penalty + if nosurface then 0.0 else + switch surface=asphalt|paved 0.0 switch surface=concrete|paving_stones 0.2 + switch surface=sett|compacted 0.4 switch surface=cobblestone|ground|earth|unpaved|dirt|fine_gravel 0.6 + switch surface=grass|sand 1.0 switch surface=gravel|pebblestone 1.5 0.6 + +assign tracktype_surface_penalty + if nosurfacenortracktype then ( switch ismainroad 0.0 switch isotherroad 0.0 switch highway=path 0.8 0.4 ) + else if nosurface then tracktype_penalty + else if tracktype= then surface_penalty else + max tracktype_penalty surface_penalty + +assign not_isbike_penalty if isbike then 0.0 + else if ismainroad then + add switch bicycle=use_sidepath 2.0 0.0 + switch highway=trunk|trunk_link 8.2 switch highway=primary|primary_link 1.5 + switch highway=secondary|secondary_link 0.4 0.3 # tertiary|tertiary_link|unclassified + else if istrack then + switch highway=footway 3.5 switch or ispaved tracktype=grade1 0.0 + switch and tracktype= not isunpaved ( switch highway=path 3.5 1.0 ) + switch tracktype= 3.0 switch tracktype=grade1 0.2 + switch tracktype=grade2 0.6 switch tracktype=grade3 1.2 + switch tracktype=grade4 2.0 switch tracktype=grade5 3.0 + 3.0 + else + switch highway=pedestrian 2.0 switch highway=bridleway 2.0 + switch highway=cycleway 0.0 switch highway=residential|living_street 0.0 + switch highway=service 0.0 0.0 + +assign wet_penalty if not iswet then 0.0 else + switch surface=cobblestone|sett 1.0 switch ispaved 0.0 + switch surface=compacted 0.6 switch surface=fine_gravel 0.8 + switch surface= switch not istrack 0.5 switch highway=path 2.0 1.0 + switch surface=grass switch highway=path 2.5 1.5 + switch surface=ground|earth|unpaved|sand|dirt|mud switch highway=path 3.5 2.0 + 2.0 + +# bend /HWclass_bfactor_components + +# bend /roadmaxpenalties + +# bstart /trafficpenalties +# Penalty for unsafe roads. As wet fallback, it does not so strictly avoid unsafe +assign unsafe_penalty + if and avoid_unsafe and ismainroad not isbike + then multiply unsafe_penalty_value ( if iswet then 0.5 else 1.0 ) + else 0.0 + + + +assign trafficpenalty0 = ( + if not allow_traffic_penalty then 0.0 else + if highway=primary|primary_link then + ( + if estimated_traffic_class=4 then 0.2 + else if estimated_traffic_class=5 then 0.4 + else if estimated_traffic_class=6|7 then 0.6 + else 0 + ) + else if highway=secondary|secondary_link then + ( + if estimated_traffic_class=3 then 0.2 + else if estimated_traffic_class=4 then 0.4 + else if estimated_traffic_class=5 then 0.6 + else if estimated_traffic_class=6|7 then 1 + else 0 + ) + else if highway=tertiary|tertiary_link then + ( + if estimated_traffic_class=2 then 0.1 + else if estimated_traffic_class=3 then 0.3 + else if estimated_traffic_class=4 then 0.5 + else if estimated_traffic_class=5|6|7 then 1 + else 0 + ) + else 0 + ) + +assign trafficpenalty = + if hascycleway then min 0.3 trafficpenalty0 + else trafficpenalty0 + +# bend /trafficpenalties + +# bstart /costfactors + +assign penaltymax = max roughness_penalty max tracktype_surface_penalty max wet_penalty trafficpenalty + +assign rawcostfactor ( # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor + switch and highway= not route=ferry 10000 #only highways unless ferry + switch highway=motorway|motorway_link|proposed|abandoned 10000 + + # all other exclusions below (access, steps, ferries,..) should not be deleted by the decoder, to be available in voice-hint-processing + min 9999 + + switch highway=steps switch allow_steps 40 10000 + switch route=ferry switch allow_ferries 5.67 10000 + switch highway=construction 10000 + + add highwayclass_basefactor add not_isbike_penalty add unsafe_penalty max penaltymax nonpath_penalty + ) + + assign isCFgt9997 greater rawcostfactor 9997 + + assign LDCRboost multiply sub 1.0 rawcostfactor cycleroutes_pref + assign cycleroute_tweak + #2.6 reworked : non cyclenetwork penalty = + cycleroutes_pref ( 0..1 , default 0.2) + # ICN boost = - ( CF - 1 ) * cycleroutes_pref, leading to CF=1.0 for cycleroutes_pref = 1.0 + # other CN: weitgted average of above, with weights ncncoef, lcncoef shifting with cycleroutes_pref + + if not greater cycleroutes_pref 0.0 then 0.0 + else if not is_ldcr then cycleroutes_pref + else if isicn then LDCRboost + else if isncn then add multiply ncncoef cycleroutes_pref multiply ( sub 1.0 ncncoef ) LDCRboost + else add multiply lcncoef cycleroutes_pref multiply ( sub 1.0 lcncoef ) LDCRboost + + # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor + assign rawcostfactor2 if isCFgt9997 then rawcostfactor + else add rawcostfactor add cycleroute_tweak add MTB_factor_for_road smallpaved_factor_for_road + + assign access-penalty max onewaypenalty accesspenalty + + assign costfactor if isCFgt9997 then rawcostfactor2 else add access-penalty add Flat_Penalty max 1.0 rawcostfactor2 + + assign uphillcostfactor if or not UDcostON isCFgt9997 then costfactor else + add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) + else add uphillCFshift add rawcostfactor2 switch ismainroad ( multiply 0.4 sub univ_factor_coef 0.5 ) ( multiply -0.5 univ_factor_coef ) + + assign downhillcostfactor if or not UDcostON isCFgt9997 then costfactor else + add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) + else add downhillCFshift add rawcostfactor2 multiply -0.2 univ_factor_coef + +# bend /costfactors + +# bstart /priorityclassifiers + +# way priorities used for voice hint generation + +assign priorityclassifier = ( + + if ( highway=motorway ) then 30 + else if ( highway=motorway_link ) then 29 + else if ( highway=trunk ) then 28 + else if ( highway=trunk_link ) then 27 + else if ( highway=primary ) then 26 + else if ( highway=primary_link ) then 25 + else if ( highway=secondary ) then 24 + else if ( highway=secondary_link ) then 23 + else if ( highway=tertiary ) then 22 + else if ( highway=tertiary_link ) then 21 + else if ( highway=unclassified ) then 20 + else if ( highway=residential|living_street ) then 16 + else if ( highway=service ) then 14 + else if ( tracktype=grade1 ) then 6 + else if ( highway=cycleway ) then 6 + else if ( bicycle=designated ) then 6 + else if ( highway=bridleway ) then 4 + else if ( highway=track|road|footway ) then 4 + else if ( highway=steps|path|pedestrian ) then 2 + else 0 + ) + +# some more classifying bits used for voice hint generation... + +assign isbadoneway = not equal onewaypenalty 0 +assign isgoodoneway = if reversedirection=yes then oneway=-1 + else if oneway= then junction=roundabout else oneway=yes|true|1 +assign isroundabout = junction=roundabout +assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link +assign isgoodforcars = if greater priorityclassifier 6 then true + else if highway=residential|living_street|service then true + else if ( and highway=track tracktype=grade1 ) then true + else false + +# ... encoded into a bitmask + +assign classifiermask add isbadoneway + add multiply isgoodoneway 2 + add multiply isroundabout 4 + add multiply islinktype 8 + multiply isgoodforcars 16 + +# bend /priorityclassifiers + +# bend /way + +# bstart /node +---context:node # following code refers to node tags + +assign initial_cost_node 0 # 0 as default + +assign defaultaccess = + if ( access= ) then if allow_default_barrier_restriction then not barrier=gate # add default barrier restrictions here! - modified v2.5.15, conditioned in 2.6 + else true + else if ( access=private|no ) then false + else true + +assign bikeaccess = + if nodeaccessgranted=yes then true + else if bicycle= then + ( + if vehicle= then defaultaccess + else not vehicle=private|no + ) + else not bicycle=private|no|dismount + +assign footaccess = + if bicycle=dismount then true + else if foot= then defaultaccess + else not foot=private|no + + +assign initialcost = + add ( if highway=traffic_signals then 120 + else if highway=stop then 60 + else if and highway=crossing bicycle=no then 60 + else if and highway=crossing crossing=no then 300 # workaround affecting road routing + else if ( ford=yes ) then ford_initialcost_node + else initial_cost_node ) + if bikeaccess then 0 else ( if footaccess then 100 else 1000000 ) + +# bend /node diff --git a/misc/profiles2/Trekking-dry-private.brf b/misc/profiles2/Trekking-dry-private.brf new file mode 100644 index 0000000..79a05da --- /dev/null +++ b/misc/profiles2/Trekking-dry-private.brf @@ -0,0 +1,562 @@ +# Poutnik's Trekking profile template for Trekking profile variants +# Version 2.6.* new max cost system +# +# *) = See also https://github.com/poutnikl/Brouter-profiles/wiki +# **) = See also https://github.com/poutnikl/Trekking-Poutnik/wiki +# +# Standard Trekking profile by Poutnik, for dry weather +# +# Legend above is the placeholder for generated comments of final profiles +# See the HistoryLog.txt file for file history, the wikis above for verbose comments. + +# bstart /global +---context:global +assign iswet 0 # 0 as default, *) flag for weather conditions +assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style +assign cycleroutes_pref 0.2 # also CRP *) costfactor penalty for not being cycleroute +assign MTB_factor 0.0 # default 0.0, *) +assign smallpaved_factor 0.0 # default 0.0, *) +assign avoid_unsafe 0 # 0 as default, gives penalty to mainroad without bike friendly status. +assign hills 1 # 1=default / 0=BRouter default/ 1=+ penalty for uphills >3.0%/ 2=velomobile-like avoiding slopes, 3= simulates ascend/length time equiv. + # 4=valley mode, 5=No-Flats mode +assign isbike_for_mainroads true # default=true / if false then bike friendly tag hints for mainroads are ignored, keeping their high penalties. v2.5.20 +assign path_preference 0.0 # 0.0 as default, try 20.0 to penalize nonpath ways a/o paved ways + +assign consider_elevation 1 # 1 as default +assign consider_smoothness 1 # 1 as default +assign allow_steps 1 # 1 as default +assign allow_ferries 1 # 1 as default +assign allow_traffic_penalty 1 # 1 as default + +assign StrictNOBicycleaccess 0 # 0 allows but penalizes foot only access / 1 forbides foot only access. +assign valley_nonflat_multiplier = 2.0 + +assign allow_default_barrier_restriction false # If true, default access for barrier=gate is false. see node context + +# Internal parameters - not intended to be tweaked by end users, unless they know what they are doing. + +#new in 2.5.12 + +assign NoFlatMode equal hills 5 +assign ValleyMode equal hills 4 +assign originalisbike false + +assign uphillcostvalue switch equal hills 1 70 switch equal hills 2 80 + switch equal hills 3 60 switch ValleyMode 150 switch NoFlatMode 0 0 +assign uphillcutoffvalue switch equal hills 1 3.0 switch equal hills 2 1.0 + switch equal hills 3 0.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 +assign downhillcutoffvalue switch equal hills 1 1.5 switch equal hills 2 0.5 + switch equal hills 3 1.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 +assign downhillcostvalue switch equal hills 1 60 switch equal hills 2 80 + switch equal hills 3 0 switch ValleyMode 150 switch NoFlatMode 0 0 + +assign Flat_Penalty if NoFlatMode then 1.5 else 0.0 + +assign validForBikes 1 +assign processUnusedTags 0 # 1 is old Brouter behaviour, 0 is new Brouter default, more efficient, but ignores tags not used by a profile. + + +# positive smallpaved factor effect subtracts itself from MTB factor effect +# on MTB-like OSM way preference and elevation effect attenuation + +#v2.5.14 assign MTBminusSP_factor sub MTB_factor ( max 0 smallpaved_factor ) - pre v2.5.14 + +#v2.5.14 +assign Hill_factor min 3 max -3 sub MTB_factor smallpaved_factor +assign Road_factor min 3 max -3 ( sub ( sub 0.0 MTB_factor ) smallpaved_factor ) + +assign positive_smallpaved_factor not lesser smallpaved_factor 0.0 +assign abs_smallpaved_factor multiply ( switch positive_smallpaved_factor 1.0 -1.0 ) smallpaved_factor + +assign MTB_hillcostfactor multiply 0.3333 Hill_factor + # It changes hillcosts to be 0.0 at Hill_factor = 3.0 and twice at -3.0 + # Hill_factor 1..-1 leads hillcost to decrease e.g. from 60 to 40 / increase from 60 to 80 + +assign downhillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) downhillcostvalue ) else 0 +assign uphillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) uphillcostvalue ) else 0 +assign uphillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) uphillcutoffvalue ) else 1.5 +assign downhillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) downhillcutoffvalue ) else 1.5 + +assign elevationpenaltybuffer if ValleyMode then 10 else 5 # 5 is trekking default +assign elevationmaxbuffer if ValleyMode then 20 else 10 # 10 is trekking default +assign elevationbufferreduce if ValleyMode then 0.0 else ( multiply 0.333 max uphillcutoff downhillcutoff ) # 0.0 is trekking default + +assign uphillCFshift 0.0 # experimental shifting of up/downhillcostfactors as alternative way of +assign downhillCFshift 0.0 # prioritizing/penalizing of up/downhills, based on length, not elevation + +assign pass1coefficient 1.8 +assign pass2coefficient 0 + +assign use_proposed_cn 1 # 0 as default, considers proposed cycle networks as unmarked but valid cycleroutes. +assign considerTurnRestrictions = true #v2.5.11 + +assign unsafe_penalty_value 1.0 # 1 - was 2 in Trekking, but this may cause U-like safe routes +assign cost_of_unknown 2.0 # 2 as default, cost of highway= + +assign c_ford_initialcost_node = 500 +assign c_ford_initialcost_way = 1000 +assign c_ford_costfactor = 50 +assign million = 1000000 + +assign ford_handling_coef + switch ( lesser Hill_factor -1.49 ) million switch ( lesser Hill_factor -0.99 ) 20 + switch ( lesser Hill_factor -0.49 ) 5.0 switch ( lesser Hill_factor 0.01 ) 1.0 + switch ( lesser Hill_factor 0.51 ) 0.4 switch ( lesser Hill_factor 1.01 ) 0.1 + switch ( lesser Hill_factor 1.51 ) 0.05 0.0 + +assign ford_initialcost_way = if ( equal ford_handling_coef million ) then million else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_initialcost_way ford_handling_coef + +assign ford_initialcost_node = if ( equal ford_handling_coef million ) then million else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_initialcost_node ford_handling_coef + +assign ford_costfactor = if ( equal ford_handling_coef million ) then 9999 else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_costfactor ford_handling_coef + +assign UDcostON true + +assign ncncoef max 0 min 1 multiply cycleroutes_pref 0.2 +assign lcncoef max 0 min 1 multiply cycleroutes_pref 1.0 + +# bend /global +# bstart /way +---context:way # following code refers to way-tags +# bstart /wayvariables +assign isicn route_bicycle_icn=yes +assign isncn or route_bicycle_ncn=yes ncn=yes +assign isrcn or route_bicycle_rcn=yes rcn=yes +assign islcn or route_bicycle_lcn=yes lcn=yes + +assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes + +assign any_cn_yes or lcn=yes or rcn=yes ncn=yes +assign any_cn_proposed or lcn=proposed or rcn=proposed ncn=proposed +assign any_cn or any_cn_yes switch use_proposed_cn any_cn_proposed 0 + +assign nodeaccessgranted or any_cycleroute any_cn + +assign is_ldcr if ( equal cycleroutes_pref 0.0 ) then false else nodeaccessgranted + +assign istrack highway=track|road|path|footway +assign ismainroad highway=motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified +assign isotherroad = not or istrack ismainroad + +assign hascycleway = not + and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) ( or cycleway:right= cycleway:right=no ) + +#2.6.* inserted originalisbike option +assign isbike_candidate or bicycle=yes|permissive|designated or hascycleway + if originalisbike then lcn=yes else nodeaccessgranted + +assign isbike and ( or ( not ismainroad ) isbike_for_mainroads ) isbike_candidate + + +assign ispaved surface=paved|asphalt|concrete|paving_stones +assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone + +assign probablyGood or ispaved and isbike not isunpaved #probably good surface - weather independent + +assign turncost if ismainroad then 90 else if ispaved then 60 else 30 +# Turn cost is based solely on estimation of road speediness and eventual time cost of turning, partially promoting tracks ) + +assign ismuddy and iswet + and ( not surface=gravel|pebblestone ) # ***) + ( or isunpaved ( and surface= and highway=track|path not tracktype=grade1 ) ) + +assign nosurface or surface= surface=unknown +assign nosurfacenortracktype and nosurface tracktype= +assign ishard or ispaved surface=cobblestone|sett|compacted|fine_gravel|gravel|pebblestone +assign issoft not or nosurface ishard + +# bend /wayvariables + + +# bstart /initialcost +assign initialclassifier +if route=ferry then 1 +else if ( ford=yes ) then 15 +else if ( highway=motorway|motorway_link ) then 2 +else if ( highway=trunk|trunk_link ) then 3 +else if ( highway=primary|primary_link ) then 4 +else if ( highway=secondary|secondary_link ) then 5 +else if ( highway=tertiary|tertiary_link ) then 6 +else if ( highway=unclassified ) then 7 +else if ( highway=residential ) then 8 +else if ( highway=living_street ) then 9 +else if ( highway=service ) then 10 +else if ( highway=footway ) then 11 +else if ( istrack ) then 12 +else if ( highway=cycleway ) then 13 + else 14 + +assign initialcost +if route=ferry then 10000 +else if ( ford=yes ) then ford_initialcost_way +else if ( highway=motorway|motorway_link|trunk|trunk_link ) then 500 +else if ( highway=primary|primary_link ) then 120 +else if ( highway=secondary|secondary_link ) then 80 +else if ( highway=tertiary|tertiary_link|unclassified ) then 50 +else 30 + +# bend /initialcost + +# bstart /wayaccess + +assign defaultaccess = + if access= then not motorroad=yes + else if access=private|no then false + else true + +assign bikeaccess = + if nodeaccessgranted then true + else if hascycleway then true + else if bicycle= then ( if vehicle= then defaultaccess else not vehicle=private|no ) + else not bicycle=private|no|dismount + +assign footaccess = + if bikeaccess then true + else if bicycle=dismount then true + else if foot= then defaultaccess + else not foot=private|no + +assign accesspenalty = + if bikeaccess then 0 + else if footaccess then + ( if StrictNOBicycleaccess then 10000 else 4 ) + else 10000 + +# handle one-ways. On primary roads, wrong-oneways should be close to forbidden +# while on other ways we just add 4 to the costfactor +# making it at least 5, as you are allowed to push your bike. + +assign badoneway = + if reversedirection=yes then + if oneway:bicycle=yes then true + else if oneway= then junction=roundabout + else oneway=yes|true|1 + else oneway=-1 + +assign onewaypenalty = + if ( badoneway ) then + if cycleway=opposite|opposite_lane|opposite_track then 0 + else if oneway:bicycle=no then 0 + else if highway=primary|primary_link then 50 + else if highway=secondary|secondary_link then 30 + else if highway=tertiary|tertiary_link then 20 + else 4.0 + + else 0.0 + +# bend /wayaccess + +# bstart /roadmaxpenalties + +# bstart /roughness_penalty +assign smoothness_penalty +# http://wiki.openstreetmap.org/wiki/Key:smoothness + +if not consider_smoothness then 0.0 else +if smoothness= then 0.0 else +if smoothness=excellent|very_good|good then 0.0 else +if smoothness=intermediate then 0.2 else +if smoothness=bad|robust_wheels then 0.5 else +if smoothness=very_bad|high_clearance then 1.2 else +if smoothness=horrible|off_road_wheels then 2.5 else +if smoothness=very_horrible then 5.0 else +if smoothness=impassable then 10.0 else +0.0 + +assign mtb_scale_penalty if not consider_smoothness then 0.0 else + +# Remember this is for trekking bikes, not MTB. There are MTB dedicated profiles. +# http://wiki.openstreetmap.org/wiki/Key:mtb:scale + +if mtb:scale= then 0.0 else if mtb:scale=0- then 0.0 else +if mtb:scale=0 then 0.0 else if mtb:scale=0+ then 0.3 else +if mtb:scale=1- then 0.7 else if mtb:scale=1 then 1.2 else +if mtb:scale=1+ then 1.8 else if mtb:scale=2- then 2.5 else +if mtb:scale=2 then 5.0 else if mtb:scale=2+ then 10.0 else +if mtb:scale=3 then 15.0 else +if mtb:scale=4|5|6 then 9000 + else 0.0 + +assign roughness_penalty max smoothness_penalty max mtb_scale_penalty ( if ford=yes then ford_costfactor else 0 ) + +# bend /roughness_penalty + +# bstart /MTB_SP_tweaks + +assign rough_coef = add 1.0 ( multiply 0.33 roughness_penalty ) + +assign univ_factor_coef + switch highway=motorway|motorway_link|trunk|trunk_link 1.0 switch highway=primary|primary_link 0.9 + switch highway=secondary|secondary_link 0.7 switch highway=tertiary|tertiary_link 0.4 + switch highway=unclassified 0.25 + switch or not istrack highway=footway ( switch ispaved 0.25 switch isunpaved -0.25 0.0 ) + switch or ispaved tracktype=grade1 0.1 + multiply rough_coef + add ( switch highway=path -0.25 0.0 ) + switch ( nosurfacenortracktype ) ( switch isbike 0.0 -0.25 ) + switch nosurface ( switch or isbike tracktype=grade2|grade3 -0.25 -0.5 ) + switch surface=compacted|fine_gravel -0.25 switch surface=cobblestone|sett -0.4 + switch surface=ground|mud|dirt -0.6 switch surface=grass|sand -0.6 + switch surface=gravel|pebblestone -0.75 -0.6 + +assign nonpath_penalty = + if equal path_preference 0.0 then 0.0 # nonpath_penalty inactive + else multiply ( max 0 path_preference ) + if ismainroad then 1 else if not or istrack highway=cycleway then 0.6 + else if ispaved then 0.4 else if or not highway=path or not isunpaved tracktype=grade1|grade2 then 0.25 + else if or not isunpaved or not highway=path or not tracktype=grade3|grade4|grade5 + surface=gravel|cobblestone|pebblestone then 0.15 else 0.0 + +assign MTB_factor_for_road if ( equal MTB_factor 0.0 ) then 0.0 else multiply MTB_factor univ_factor_coef +assign abs_univ_factor if lesser univ_factor_coef 0.0 then multiply -1.0 univ_factor_coef else univ_factor_coef +assign smallpaved_factor_for_road if ( equal smallpaved_factor 0.0 ) then 0.0 + else multiply abs_smallpaved_factor ( if positive_smallpaved_factor then abs_univ_factor else ( sub 1.0 abs_univ_factor ) ) +# bend /MTB_SP_tweaks + +# bstart /HWclass_bfactor_components + +assign highwayclass_basefactor + if ismainroad then + switch highway=trunk|trunk_link 1.8 switch highway=primary|primary_link 1.5 + switch highway=secondary|secondary_link 1.2 switch highway=tertiary|tertiary_link 1.1 1.0 + else if istrack then + switch highway=track 1.0 switch highway=path 1.1 switch highway=footway 1.2 1.0 # highway=road + else + switch highway=pedestrian 2.0 switch highway=bridleway 3.0 + switch highway=cycleway 1.0 switch highway=residential|living_street 1.0 + switch highway=service 1.1 cost_of_unknown + + +assign tracktype_penalty + if tracktype= then 0.0 else + switch tracktype=grade1 0.0 switch tracktype=grade2 0.4 switch tracktype=grade3 0.7 + switch tracktype=grade4 0.9 switch tracktype=grade5 1.0 0.5 + +assign surface_penalty + if nosurface then 0.0 else + switch surface=asphalt|paved 0.0 switch surface=concrete|paving_stones 0.2 + switch surface=sett|compacted 0.4 switch surface=cobblestone|ground|earth|unpaved|dirt|fine_gravel 0.6 + switch surface=grass|sand 1.0 switch surface=gravel|pebblestone 1.5 0.6 + +assign tracktype_surface_penalty + if nosurfacenortracktype then ( switch ismainroad 0.0 switch isotherroad 0.0 switch highway=path 0.8 0.4 ) + else if nosurface then tracktype_penalty + else if tracktype= then surface_penalty else + max tracktype_penalty surface_penalty + +assign not_isbike_penalty if isbike then 0.0 + else if ismainroad then + add switch bicycle=use_sidepath 2.0 0.0 + switch highway=trunk|trunk_link 8.2 switch highway=primary|primary_link 1.5 + switch highway=secondary|secondary_link 0.4 0.3 # tertiary|tertiary_link|unclassified + else if istrack then + switch highway=footway 3.5 switch or ispaved tracktype=grade1 0.0 + switch and tracktype= not isunpaved ( switch highway=path 3.5 1.0 ) + switch tracktype= 3.0 switch tracktype=grade1 0.2 + switch tracktype=grade2 0.6 switch tracktype=grade3 1.2 + switch tracktype=grade4 2.0 switch tracktype=grade5 3.0 + 3.0 + else + switch highway=pedestrian 2.0 switch highway=bridleway 2.0 + switch highway=cycleway 0.0 switch highway=residential|living_street 0.0 + switch highway=service 0.0 0.0 + +assign wet_penalty if not iswet then 0.0 else + switch surface=cobblestone|sett 1.0 switch ispaved 0.0 + switch surface=compacted 0.6 switch surface=fine_gravel 0.8 + switch surface= switch not istrack 0.5 switch highway=path 2.0 1.0 + switch surface=grass switch highway=path 2.5 1.5 + switch surface=ground|earth|unpaved|sand|dirt|mud switch highway=path 3.5 2.0 + 2.0 + +# bend /HWclass_bfactor_components + +# bend /roadmaxpenalties + +# bstart /trafficpenalties +# Penalty for unsafe roads. As wet fallback, it does not so strictly avoid unsafe +assign unsafe_penalty + if and avoid_unsafe and ismainroad not isbike + then multiply unsafe_penalty_value ( if iswet then 0.5 else 1.0 ) + else 0.0 + + + +assign trafficpenalty0 = ( + if not allow_traffic_penalty then 0.0 else + if highway=primary|primary_link then + ( + if estimated_traffic_class=4 then 0.2 + else if estimated_traffic_class=5 then 0.4 + else if estimated_traffic_class=6|7 then 0.6 + else 0 + ) + else if highway=secondary|secondary_link then + ( + if estimated_traffic_class=3 then 0.2 + else if estimated_traffic_class=4 then 0.4 + else if estimated_traffic_class=5 then 0.6 + else if estimated_traffic_class=6|7 then 1 + else 0 + ) + else if highway=tertiary|tertiary_link then + ( + if estimated_traffic_class=2 then 0.1 + else if estimated_traffic_class=3 then 0.3 + else if estimated_traffic_class=4 then 0.5 + else if estimated_traffic_class=5|6|7 then 1 + else 0 + ) + else 0 + ) + +assign trafficpenalty = + if hascycleway then min 0.3 trafficpenalty0 + else trafficpenalty0 + +# bend /trafficpenalties + +# bstart /costfactors + +assign penaltymax = max roughness_penalty max tracktype_surface_penalty max wet_penalty trafficpenalty + +assign rawcostfactor ( # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor + switch and highway= not route=ferry 10000 #only highways unless ferry + switch highway=motorway|motorway_link|proposed|abandoned 10000 + + # all other exclusions below (access, steps, ferries,..) should not be deleted by the decoder, to be available in voice-hint-processing + min 9999 + + switch highway=steps switch allow_steps 40 10000 + switch route=ferry switch allow_ferries 5.67 10000 + switch highway=construction 10000 + + add highwayclass_basefactor add not_isbike_penalty add unsafe_penalty max penaltymax nonpath_penalty + ) + + assign isCFgt9997 greater rawcostfactor 9997 + + assign LDCRboost multiply sub 1.0 rawcostfactor cycleroutes_pref + assign cycleroute_tweak + #2.6 reworked : non cyclenetwork penalty = + cycleroutes_pref ( 0..1 , default 0.2) + # ICN boost = - ( CF - 1 ) * cycleroutes_pref, leading to CF=1.0 for cycleroutes_pref = 1.0 + # other CN: weitgted average of above, with weights ncncoef, lcncoef shifting with cycleroutes_pref + + if not greater cycleroutes_pref 0.0 then 0.0 + else if not is_ldcr then cycleroutes_pref + else if isicn then LDCRboost + else if isncn then add multiply ncncoef cycleroutes_pref multiply ( sub 1.0 ncncoef ) LDCRboost + else add multiply lcncoef cycleroutes_pref multiply ( sub 1.0 lcncoef ) LDCRboost + + # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor + assign rawcostfactor2 if isCFgt9997 then rawcostfactor + else add rawcostfactor add cycleroute_tweak add MTB_factor_for_road smallpaved_factor_for_road + + assign access-penalty max onewaypenalty accesspenalty + + assign costfactor if isCFgt9997 then rawcostfactor2 else add access-penalty add Flat_Penalty max 1.0 rawcostfactor2 + + assign uphillcostfactor if or not UDcostON isCFgt9997 then costfactor else + add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) + else add uphillCFshift add rawcostfactor2 switch ismainroad ( multiply 0.4 sub univ_factor_coef 0.5 ) ( multiply -0.5 univ_factor_coef ) + + assign downhillcostfactor if or not UDcostON isCFgt9997 then costfactor else + add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) + else add downhillCFshift add rawcostfactor2 multiply -0.2 univ_factor_coef + +# bend /costfactors + +# bstart /priorityclassifiers + +# way priorities used for voice hint generation + +assign priorityclassifier = ( + + if ( highway=motorway ) then 30 + else if ( highway=motorway_link ) then 29 + else if ( highway=trunk ) then 28 + else if ( highway=trunk_link ) then 27 + else if ( highway=primary ) then 26 + else if ( highway=primary_link ) then 25 + else if ( highway=secondary ) then 24 + else if ( highway=secondary_link ) then 23 + else if ( highway=tertiary ) then 22 + else if ( highway=tertiary_link ) then 21 + else if ( highway=unclassified ) then 20 + else if ( highway=residential|living_street ) then 16 + else if ( highway=service ) then 14 + else if ( tracktype=grade1 ) then 6 + else if ( highway=cycleway ) then 6 + else if ( bicycle=designated ) then 6 + else if ( highway=bridleway ) then 4 + else if ( highway=track|road|footway ) then 4 + else if ( highway=steps|path|pedestrian ) then 2 + else 0 + ) + +# some more classifying bits used for voice hint generation... + +assign isbadoneway = not equal onewaypenalty 0 +assign isgoodoneway = if reversedirection=yes then oneway=-1 + else if oneway= then junction=roundabout else oneway=yes|true|1 +assign isroundabout = junction=roundabout +assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link +assign isgoodforcars = if greater priorityclassifier 6 then true + else if highway=residential|living_street|service then true + else if ( and highway=track tracktype=grade1 ) then true + else false + +# ... encoded into a bitmask + +assign classifiermask add isbadoneway + add multiply isgoodoneway 2 + add multiply isroundabout 4 + add multiply islinktype 8 + multiply isgoodforcars 16 + +# bend /priorityclassifiers + +# bend /way + +# bstart /node +---context:node # following code refers to node tags + +assign initial_cost_node 0 # 0 as default + +assign defaultaccess = + if ( access= ) then if allow_default_barrier_restriction then not barrier=gate # add default barrier restrictions here! - modified v2.5.15, conditioned in 2.6 + else true + else if ( access=private|no ) then false + else true + +assign bikeaccess = + if nodeaccessgranted=yes then true + else if bicycle= then + ( + if vehicle= then defaultaccess + else not vehicle=private|no + ) + else not bicycle=private|no|dismount + +assign footaccess = + if bicycle=dismount then true + else if foot= then defaultaccess + else not foot=private|no + + +assign initialcost = + add ( if highway=traffic_signals then 120 + else if highway=stop then 60 + else if and highway=crossing bicycle=no then 60 + else if and highway=crossing crossing=no then 300 # workaround affecting road routing + else if ( ford=yes ) then ford_initialcost_node + else initial_cost_node ) + if bikeaccess then 0 else ( if footaccess then 100 else 1000000 ) + +# bend /node diff --git a/misc/profiles2/fastbike-private.brf b/misc/profiles2/fastbike-private.brf new file mode 100644 index 0000000..1c48994 --- /dev/null +++ b/misc/profiles2/fastbike-private.brf @@ -0,0 +1,359 @@ +# +# A fastbike could be a racing bike or a speed pedelec. +# But also at night or in rainy weather you might want +# to fallback to this one. +# +# Structure is similar to trekking.brf, see this for documenation. +# +# With default configuration (tested for Europe), trunks are +# strongly avoided even if there's no bike restriction +# (assuming implicit bicycle=no), and motorways are not allowed +# even with bicycle=yes). This is not the expected behavior for some countries +# such as Japan or Australia. +# Then, you should switch allow_motorways variable to true for these regions. +# + +---context:global # following code refers to global config + +# Bike profile +assign validForBikes = true + +# Use the following switches to change behaviour +assign allow_steps = true # %allow_steps% | Set to false to disallow steps | boolean +assign allow_ferries = true # %allow_ferries% | set to false to disallow ferries | boolean +assign allow_motorways = false # %allow_motorways% | Set to true to allow motorways (useful in Asia / Oceania for example) | boolean +assign ignore_cycleroutes = false # %ignore_cycleroutes% | Set to true for better elevation results | boolean +assign stick_to_cycleroutes = false # %stick_to_cycleroutes% | Set to true to just follow cycleroutes | boolean +assign avoid_unsafe = false # %avoid_unsafe% | Set to true to avoid standard highways | boolean +assign avoid_path = false # %avoid_path% | Set to true to avoid pathes | boolean + +assign consider_traffic = false # %consider_traffic% | Activate to avoid traffic | boolean +assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean +assign consider_river = false # %consider_river% | Activate to prefer a route along rivers or sees | boolean +assign consider_forest = false # %consider_forest% | Activate to prefer a route in forest or parks | boolean +assign consider_town = false # %consider_town% | Activate to bypass cities / big towns as far as possible | boolean + +# Change elevation parameters +assign consider_elevation = true # %consider_elevation% | Set to false to ignore elevation in routing | boolean +assign downhillcost = 60 # %downhillcost% | Cost for going downhill | number +assign downhillcutoff = 1.5 # %downhillcutoff% | Gradients below this value in percents are not counted. | number +assign uphillcost = 0 # %uphillcost% | Cost for going uphill | number +assign uphillcutoff = 1.5 # %uphillcutoff% | Gradients below this value in percents are not counted. | number + +assign downhillcost = if consider_elevation then downhillcost else 0 +assign uphillcost = if consider_elevation then uphillcost else 0 + +# Kinematic model parameters (travel time computation) +assign totalMass = 90 # %totalMass% | Mass (in kg) of the bike + biker, for travel time computation | number +assign maxSpeed = 45 # %maxSpeed% | Absolute maximum speed (in km/h), for travel time computation | number +assign S_C_x = 0.225 # %S_C_x% | Drag coefficient times the reference area (in m^2), for travel time computation | number +assign C_r = 0.01 # %C_r% | Rolling resistance coefficient (dimensionless), for travel time computation | number +assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number + +# Turn instructions settings +assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style] +assign turnInstructionCatchingRange = 40 # %turnInstructionCatchingRange% | Within this distance (in m) several turning instructions are combined into one and the turning angles are better approximated to the general direction | number +assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean +assign considerTurnRestrictions = true # %considerTurnRestrictions% | Set to true to take turn restrictions into account | boolean + +assign processUnusedTags = false # %processUnusedTags% | Set to true to output unused tags in data tab | boolean + +---context:way # following code refers to way-tags + +assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes +assign nodeaccessgranted or any_cycleroute lcn=yes + +assign ispaved or surface=paved or surface=asphalt or surface=concrete or surface=paving_stones surface=sett +assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone + +assign turncost = if junction=roundabout then 0 + else 90 +assign initialclassifier = + if route=ferry then 1 + else 0 + +assign initialcost switch route=ferry 10000 0 + +# +# implicit access here just from the motorroad tag +# (implicit access rules from highway tag handled elsewhere) +# +assign defaultaccess + switch access= + ( + if motorroad=yes then false + else if highway=motorway|motorway_link then false + else true + ) + switch or access=private access=no + false + true + +# +# calculate logical bike access +# +assign bikeaccess = + switch bicycle= + switch bicycle_road=yes + true + switch vehicle= + ( if highway=footway then false else defaultaccess ) + not vehicle=private|no + not or bicycle=private or bicycle=no bicycle=dismount + +# +# calculate logical foot access +# +assign footaccess = + or bikeaccess + or bicycle=dismount + switch foot= + defaultaccess + not or foot=private foot=no + +# +# if not bike-, but foot-acess, just a moderate penalty, +# otherwise access is forbidden +# +assign accesspenalty + switch bikeaccess + 0 + switch footaccess + 6 + switch any_cycleroute + 15 + 10000 + +# +# handle one-ways. On primary roads, wrong-oneways should +# be close to forbidden, while on other ways we just add +# 6 to the costfactor (making it at least 7 - you are allowed +# to push your bike) +# +assign badoneway = + if reversedirection=yes then + if oneway:bicycle=yes then true + else if oneway= then junction=roundabout + else oneway=yes|true|1 + else oneway=-1 + +assign onewaypenalty = + if ( badoneway ) then + ( + if ( cycleway=opposite|opposite_lane|opposite_track ) then 0 + else if ( cycleway:left=opposite|opposite_lane|opposite_track ) then 0 + else if ( cycleway:right=opposite|opposite_lane|opposite_track ) then 0 + else if ( oneway:bicycle=no ) then 0 + else if ( cycleway:left:oneway=no ) then 0 + else if ( cycleway:right:oneway=no ) then 0 + else if ( junction=roundabout|circular ) then 60 + else if ( highway=primary|primary_link ) then 50 + else if ( highway=secondary|secondary_link ) then 30 + else if ( highway=tertiary|tertiary_link ) then 20 + else 6.0 + ) + else 0.0 + +# Eventually compute traffic penalty +assign hascycleway = not + and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) ( or cycleway:right= cycleway:right=no ) + +assign trafficpenalty0 = + if highway=primary|primary_link then + ( + if estimated_traffic_class=4 then 0.2 + else if estimated_traffic_class=5 then 0.4 + else if estimated_traffic_class=6|7 then 0.6 + else 0 + ) + else if highway=secondary|secondary_link then + ( + if estimated_traffic_class=3 then 0.2 + else if estimated_traffic_class=4 then 0.4 + else if estimated_traffic_class=5 then 0.6 + else if estimated_traffic_class=6|7 then 1 + else 0 + ) + else if highway=tertiary|tertiary_link then + ( + if estimated_traffic_class=2 then 0.1 + else if estimated_traffic_class=3 then 0.3 + else if estimated_traffic_class=4 then 0.5 + else if estimated_traffic_class=5|6|7 then 1 + else 0 + ) + else 0 + +assign trafficpenalty = + if consider_traffic then + ( + if hascycleway then min 0.3 trafficpenalty0 + else trafficpenalty0 + ) + else 0 + +assign isresidentialorliving = or highway=residential|living_street living_street=yes + +# add estimate tags +assign noise_penalty + switch consider_noise + switch estimated_noise_class= 0 + switch estimated_noise_class=1 0.3 + switch estimated_noise_class=2 0.5 + switch estimated_noise_class=3 0.7 + switch estimated_noise_class=4 1 + switch estimated_noise_class=5 1.2 + switch estimated_noise_class=6 1.5 0 0 + +assign no_river_penalty + switch consider_river + switch estimated_river_class= 3 + switch estimated_river_class=1 2 + switch estimated_river_class=2 1.5 + switch estimated_river_class=3 1 + switch estimated_river_class=4 0.5 + switch estimated_river_class=5 0.2 + switch estimated_river_class=6 0 99 0 + +assign no_forest_penalty + switch consider_forest + switch estimated_forest_class= 1 + switch estimated_forest_class=1 0.5 + switch estimated_forest_class=2 0.4 + switch estimated_forest_class=3 0.25 + switch estimated_forest_class=4 0.15 + switch estimated_forest_class=5 0.1 + switch estimated_forest_class=6 0 99 0 + +assign town_penalty + switch consider_town + switch estimated_town_class= 0 + switch estimated_town_class=1 0.2 + switch estimated_town_class=2 0.4 + switch estimated_town_class=3 0.6 + switch estimated_town_class=4 0.7 + switch estimated_town_class=5 0.8 + switch estimated_town_class=6 1 99 0 + +assign costfactor + switch and highway= not route=ferry 10000 + switch or highway=proposed highway=abandoned 10000 + + min 9999 + add max onewaypenalty accesspenalty + add trafficpenalty + add town_penalty + add no_forest_penalty + add no_river_penalty + add noise_penalty + + + switch or highway=motorway highway=motorway_link switch allow_motorways 1.5 10000 + switch or highway=trunk highway=trunk_link switch allow_motorways 1.5 10 + switch or highway=primary highway=primary_link 1.2 + switch or highway=secondary highway=secondary_link 1.1 + switch or highway=tertiary highway=tertiary_link 1.0 + switch highway=unclassified switch isunpaved 10 1.1 + switch highway=pedestrian 10 + switch highway=steps 1000 + switch route=ferry 5.67 + switch highway=bridleway 5 + switch highway=cycleway 1.3 + switch isresidentialorliving switch isunpaved 10 1.2 + switch highway=service switch isunpaved 10 1.2 + switch highway=path switch avoid_path 2.1 1.1 + switch or highway=track or highway=road highway=footway + switch tracktype=grade1 switch isunpaved 3 1.2 + switch tracktype=grade2 switch isunpaved 10 3 + switch tracktype=grade3 10.0 + switch tracktype=grade4 20.0 + switch tracktype=grade5 30.0 + switch or bicycle=designated bicycle_road=yes 2.0 + switch ispaved 2.0 100.0 + 10.0 + +# way priorities used for voice hint generation + +assign priorityclassifier = + + if ( highway=motorway ) then 30 + else if ( highway=motorway_link ) then 29 + else if ( highway=trunk ) then 28 + else if ( highway=trunk_link ) then 27 + else if ( highway=primary ) then 26 + else if ( highway=primary_link ) then 25 + else if ( highway=secondary ) then 24 + else if ( highway=secondary_link ) then 23 + else if ( highway=tertiary ) then 22 + else if ( highway=tertiary_link ) then 21 + else if ( highway=unclassified ) then 20 + else if ( isresidentialorliving ) then 6 + else if ( highway=service ) then 6 + else if ( highway=cycleway ) then 6 + else if ( or bicycle=designated bicycle_road=yes ) then 6 + else if ( highway=track ) then if tracktype=grade1 then 6 else 4 + else if ( highway=bridleway|road|path|footway ) then 4 + else if ( highway=steps ) then 2 + else if ( highway=pedestrian ) then 2 + else 0 + + +# some more classifying bits used for voice hint generation... + +assign isbadoneway = not equal onewaypenalty 0 +assign isgoodoneway = if reversedirection=yes then oneway=-1 + else if oneway= then junction=roundabout else oneway=yes|true|1 +assign isroundabout = junction=roundabout +assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link +assign isgoodforcars = if greater priorityclassifier 6 then true + else if ( or isresidentialorliving highway=service ) then true + else if ( and highway=track tracktype=grade1 ) then true + else false + +# ... encoded into a bitmask + +assign classifiermask add isbadoneway + add multiply isgoodoneway 2 + add multiply isroundabout 4 + add multiply islinktype 8 + multiply isgoodforcars 16 + +# include `smoothness=` tags in the response's WayTags for track analysis +assign dummyUsage = smoothness= + + +---context:node # following code refers to node tags + +assign defaultaccess + switch access= + 1 # add default barrier restrictions here! + switch or access=private access=no + 0 + 1 + +assign bikeaccess + or nodeaccessgranted=yes + switch bicycle= + switch vehicle= + defaultaccess + switch or vehicle=private vehicle=no + 0 + 1 + switch or bicycle=private or bicycle=no bicycle=dismount + 0 + 1 + +assign footaccess + or bicycle=dismount + switch foot= + defaultaccess + switch or foot=private foot=no + 0 + 1 + +assign initialcost + switch bikeaccess + 0 + switch footaccess + 300 + 1000000 diff --git a/misc/profiles2/mtb.brf b/misc/profiles2/mtb.brf index 1b360cb..d532a9c 100644 --- a/misc/profiles2/mtb.brf +++ b/misc/profiles2/mtb.brf @@ -1,563 +1,562 @@ - # Poutnik's Trekking profile template for Trekking profile variants - # Version 2.6.* new max cost system - # - # *) = See also https://github.com/poutnikl/Brouter-profiles/wiki - # **) = See also https://github.com/poutnikl/Trekking-Poutnik/wiki - # - # MTB profile, based on MTBiker feedback - # - # Legend above is the placeholder for generated comments of final profiles - # See the HistoryLog.txt file for file history, the wikis above for verbose comments. - - # bstart /global - ---context:global - assign iswet 0 # 0 as default, *) flag for weather conditions - assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style - assign cycleroutes_pref 0.2 # also CRP *) costfactor penalty for not being cycleroute - assign MTB_factor 0.0 # default 0.0, *) - assign smallpaved_factor -0.5 # default 0.0, *) - assign avoid_unsafe 0 # 0 as default, gives penalty to mainroad without bike friendly status. - assign hills 0 # 1=default / 0=BRouter default/ 1=+ penalty for uphills >3.0%/ 2=velomobile-like avoiding slopes, 3= simulates ascend/length time equiv. - # 4=valley mode, 5=No-Flats mode - assign isbike_for_mainroads true # default=true / if false then bike friendly tag hints for mainroads are ignored, keeping their high penalties. v2.5.20 - assign path_preference 20.0 # 20.0 as default, the bigger it is the bigger it penalizes nonpath ways a/o paved ways - - assign consider_elevation 1 # 1 as default - assign consider_smoothness 1 # 1 as default - assign allow_steps 0 # 1 as default - assign allow_ferries 1 # 1 as default - assign allow_traffic_penalty 1 # 1 as default - - assign StrictNOBicycleaccess 0 # 0 allows but penalizes foot only access / 1 forbides foot only access. - assign valley_nonflat_multiplier = 2.0 - - assign allow_default_barrier_restriction false # If true, default access for barrier=gate is false. see node context - - # Internal parameters - not intended to be tweaked by end users, unless they know what they are doing. - - #new in 2.5.12 - - assign NoFlatMode equal hills 5 - assign ValleyMode equal hills 4 - assign originalisbike false - - assign uphillcostvalue switch equal hills 1 70 switch equal hills 2 80 - switch equal hills 3 60 switch ValleyMode 150 switch NoFlatMode 0 0 - assign uphillcutoffvalue switch equal hills 1 3.0 switch equal hills 2 1.0 - switch equal hills 3 0.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 - assign downhillcutoffvalue switch equal hills 1 1.5 switch equal hills 2 0.5 - switch equal hills 3 1.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 - assign downhillcostvalue switch equal hills 1 60 switch equal hills 2 80 - switch equal hills 3 0 switch ValleyMode 150 switch NoFlatMode 0 0 - - assign Flat_Penalty if NoFlatMode then 1.5 else 0.0 - - assign validForBikes 1 - assign processUnusedTags 0 # 1 is old Brouter behaviour, 0 is new Brouter default, more efficient, but ignores tags not used by a profile. - - - # positive smallpaved factor effect subtracts itself from MTB factor effect - # on MTB-like OSM way preference and elevation effect attenuation - - #v2.5.14 assign MTBminusSP_factor sub MTB_factor ( max 0 smallpaved_factor ) - pre v2.5.14 - - #v2.5.14 - assign Hill_factor min 3 max -3 sub MTB_factor smallpaved_factor - assign Road_factor min 3 max -3 ( sub ( sub 0.0 MTB_factor ) smallpaved_factor ) - - assign positive_smallpaved_factor not lesser smallpaved_factor 0.0 - assign abs_smallpaved_factor multiply ( switch positive_smallpaved_factor 1.0 -1.0 ) smallpaved_factor - - assign MTB_hillcostfactor multiply 0.3333 Hill_factor - # It changes hillcosts to be 0.0 at Hill_factor = 3.0 and twice at -3.0 - # Hill_factor 1..-1 leads hillcost to decrease e.g. from 60 to 40 / increase from 60 to 80 - - assign downhillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) downhillcostvalue ) else 0 - assign uphillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) uphillcostvalue ) else 0 - assign uphillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) uphillcutoffvalue ) else 1.5 - assign downhillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) downhillcutoffvalue ) else 1.5 - - assign elevationpenaltybuffer if ValleyMode then 10 else 5 # 5 is trekking default - assign elevationmaxbuffer if ValleyMode then 20 else 10 # 10 is trekking default - assign elevationbufferreduce if ValleyMode then 0.0 else ( multiply 0.333 max uphillcutoff downhillcutoff ) # 0.0 is trekking default - - assign uphillCFshift 0.0 # experimental shifting of up/downhillcostfactors as alternative way of - assign downhillCFshift 0.0 # prioritizing/penalizing of up/downhills, based on length, not elevation - - assign pass1coefficient 1.8 - assign pass2coefficient 0 - - assign use_proposed_cn 1 # 0 as default, considers proposed cycle networks as unmarked but valid cycleroutes. - assign considerTurnRestrictions = true #v2.5.11 - - assign unsafe_penalty_value 1.0 # 1 - was 2 in Trekking, but this may cause U-like safe routes - assign cost_of_unknown 2.0 # 2 as default, cost of highway= - - assign c_ford_initialcost_node = 500 - assign c_ford_initialcost_way = 1000 - assign c_ford_costfactor = 50 - assign million = 1000000 - - assign ford_handling_coef - switch ( lesser Hill_factor -1.49 ) million switch ( lesser Hill_factor -0.99 ) 20 - switch ( lesser Hill_factor -0.49 ) 5.0 switch ( lesser Hill_factor 0.01 ) 1.0 - switch ( lesser Hill_factor 0.51 ) 0.4 switch ( lesser Hill_factor 1.01 ) 0.1 - switch ( lesser Hill_factor 1.51 ) 0.05 0.0 - - assign ford_initialcost_way = if ( equal ford_handling_coef million ) then million else - if ( equal ford_handling_coef 0.0 ) then 0.0 else - multiply c_ford_initialcost_way ford_handling_coef - - assign ford_initialcost_node = if ( equal ford_handling_coef million ) then million else - if ( equal ford_handling_coef 0.0 ) then 0.0 else - multiply c_ford_initialcost_node ford_handling_coef - - assign ford_costfactor = if ( equal ford_handling_coef million ) then 9999 else - if ( equal ford_handling_coef 0.0 ) then 0.0 else - multiply c_ford_costfactor ford_handling_coef - - assign UDcostON true - - assign ncncoef max 0 min 1 multiply cycleroutes_pref 0.2 - assign lcncoef max 0 min 1 multiply cycleroutes_pref 1.0 - - # bend /global - # bstart /way - ---context:way # following code refers to way-tags - # bstart /wayvariables - assign isicn route_bicycle_icn=yes - assign isncn or route_bicycle_ncn=yes ncn=yes - assign isrcn or route_bicycle_rcn=yes rcn=yes - assign islcn or route_bicycle_lcn=yes lcn=yes - - assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes - - assign any_cn_yes or lcn=yes or rcn=yes ncn=yes - assign any_cn_proposed or lcn=proposed or rcn=proposed ncn=proposed - assign any_cn or any_cn_yes switch use_proposed_cn any_cn_proposed 0 - - assign nodeaccessgranted or any_cycleroute any_cn - - assign is_ldcr if ( equal cycleroutes_pref 0.0 ) then false else nodeaccessgranted - - assign istrack highway=track|road|path|footway - assign ismainroad highway=motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified - assign isotherroad = not or istrack ismainroad - - assign hascycleway = not - and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) ( or cycleway:right= cycleway:right=no ) - - #2.6.* inserted originalisbike option - assign isbike_candidate or bicycle=yes|permissive|designated or hascycleway - if originalisbike then lcn=yes else nodeaccessgranted - - assign isbike and ( or ( not ismainroad ) isbike_for_mainroads ) isbike_candidate - - - assign ispaved surface=paved|asphalt|concrete|paving_stones - assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone - - assign probablyGood or ispaved and isbike not isunpaved #probably good surface - weather independent - - assign turncost if ismainroad then 90 else if ispaved then 60 else 30 - # Turn cost is based solely on estimation of road speediness and eventual time cost of turning, partially promoting tracks ) - - assign ismuddy and iswet - and ( not surface=gravel|pebblestone ) # ***) - ( or isunpaved ( and surface= and highway=track|path not tracktype=grade1 ) ) - - assign nosurface or surface= surface=unknown - assign nosurfacenortracktype and nosurface tracktype= - assign ishard or ispaved surface=cobblestone|sett|compacted|fine_gravel|gravel|pebblestone - assign issoft not or nosurface ishard - - # bend /wayvariables - - - # bstart /initialcost - assign initialclassifier - if route=ferry then 1 - else if ( ford=yes ) then 15 - else if ( highway=motorway|motorway_link ) then 2 - else if ( highway=trunk|trunk_link ) then 3 - else if ( highway=primary|primary_link ) then 4 - else if ( highway=secondary|secondary_link ) then 5 - else if ( highway=tertiary|tertiary_link ) then 6 - else if ( highway=unclassified ) then 7 - else if ( highway=residential ) then 8 - else if ( highway=living_street ) then 9 - else if ( highway=service ) then 10 - else if ( highway=footway ) then 11 - else if ( istrack ) then 12 - else if ( highway=cycleway ) then 13 - else 14 - - assign initialcost - if route=ferry then 10000 - else if ( ford=yes ) then ford_initialcost_way - else if ( highway=motorway|motorway_link|trunk|trunk_link ) then 500 - else if ( highway=primary|primary_link ) then 120 - else if ( highway=secondary|secondary_link ) then 80 - else if ( highway=tertiary|tertiary_link|unclassified ) then 50 - else 30 - - # bend /initialcost - - # bstart /wayaccess - - assign defaultaccess = - if access= then not motorroad=yes - else if access=private|no then false - else true - - assign bikeaccess = - if nodeaccessgranted then true - else if hascycleway then true - else if bicycle= then ( if vehicle= then defaultaccess else not vehicle=private|no ) - else not bicycle=private|no|dismount - - assign footaccess = - if bikeaccess then true - else if bicycle=dismount then true - else if foot= then defaultaccess - else not foot=private|no - - assign accesspenalty = - if bikeaccess then 0 - else if footaccess then - ( if StrictNOBicycleaccess then 10000 else 4 ) - else 10000 - - # handle one-ways. On primary roads, wrong-oneways should be close to forbidden - # while on other ways we just add 4 to the costfactor - # making it at least 5, as you are allowed to push your bike. - - assign badoneway = - if reversedirection=yes then - if oneway:bicycle=yes then true - else if oneway= then junction=roundabout - else oneway=yes|true|1 - else oneway=-1 - - assign onewaypenalty = - if ( badoneway ) then - if cycleway=opposite|opposite_lane|opposite_track then 0 - else if oneway:bicycle=no then 0 - else if junction=roundabout|circular then 60 - else if highway=primary|primary_link then 50 - else if highway=secondary|secondary_link then 30 - else if highway=tertiary|tertiary_link then 20 - else 4.0 - - else 0.0 - - # bend /wayaccess - - # bstart /roadmaxpenalties - - # bstart /roughness_penalty - assign smoothness_penalty - # http://wiki.openstreetmap.org/wiki/Key:smoothness - - if not consider_smoothness then 0.0 else - if smoothness= then 0.0 else - if smoothness=excellent|very_good|good then 0.0 else - if smoothness=intermediate then 0.2 else - if smoothness=bad|robust_wheels then 0.5 else - if smoothness=very_bad|high_clearance then 1.2 else - if smoothness=horrible|off_road_wheels then 2.5 else - if smoothness=very_horrible then 5.0 else - if smoothness=impassable then 10.0 else - 0.0 - - assign mtb_scale_penalty if not consider_smoothness then 0.0 else - - # Remember this is for trekking bikes, not MTB. There are MTB dedicated profiles. - # http://wiki.openstreetmap.org/wiki/Key:mtb:scale - - if mtb:scale= then 0.0 else if mtb:scale=0- then 0.0 else - if mtb:scale=0 then 0.0 else if mtb:scale=0+ then 0.3 else - if mtb:scale=1- then 0.7 else if mtb:scale=1 then 1.2 else - if mtb:scale=1+ then 1.8 else if mtb:scale=2- then 2.5 else - if mtb:scale=2 then 5.0 else if mtb:scale=2+ then 10.0 else - if mtb:scale=3 then 15.0 else - if mtb:scale=4|5|6 then 9000 - else 0.0 - - assign roughness_penalty max smoothness_penalty max mtb_scale_penalty ( if ford=yes then ford_costfactor else 0 ) - - # bend /roughness_penalty - - # bstart /MTB_SP_tweaks - - assign rough_coef = add 1.0 ( multiply 0.33 roughness_penalty ) - - assign univ_factor_coef - switch highway=motorway|motorway_link|trunk|trunk_link 1.0 switch highway=primary|primary_link 0.9 - switch highway=secondary|secondary_link 0.7 switch highway=tertiary|tertiary_link 0.4 - switch highway=unclassified 0.25 - switch or not istrack highway=footway ( switch ispaved 0.25 switch isunpaved -0.25 0.0 ) - switch or ispaved tracktype=grade1 0.1 - multiply rough_coef - add ( switch highway=path -0.25 0.0 ) - switch ( nosurfacenortracktype ) ( switch isbike 0.0 -0.25 ) - switch nosurface ( switch or isbike tracktype=grade2|grade3 -0.25 -0.5 ) - switch surface=compacted|fine_gravel -0.25 switch surface=cobblestone|sett -0.4 - switch surface=ground|mud|dirt -0.6 switch surface=grass|sand -0.6 - switch surface=gravel|pebblestone -0.75 -0.6 - - assign nonpath_penalty = - if equal path_preference 0.0 then 0.0 # nonpath_penalty inactive - else multiply ( max 0 path_preference ) - if ismainroad then 1 else if not or istrack highway=cycleway then 0.6 - else if ispaved then 0.4 else if or not highway=path or not isunpaved tracktype=grade1|grade2 then 0.25 - else if or not isunpaved or not highway=path or not tracktype=grade3|grade4|grade5 - surface=gravel|cobblestone|pebblestone then 0.15 else 0.0 - - assign MTB_factor_for_road if ( equal MTB_factor 0.0 ) then 0.0 else multiply MTB_factor univ_factor_coef - assign abs_univ_factor if lesser univ_factor_coef 0.0 then multiply -1.0 univ_factor_coef else univ_factor_coef - assign smallpaved_factor_for_road if ( equal smallpaved_factor 0.0 ) then 0.0 - else multiply abs_smallpaved_factor ( if positive_smallpaved_factor then abs_univ_factor else ( sub 1.0 abs_univ_factor ) ) - # bend /MTB_SP_tweaks - - # bstart /HWclass_bfactor_components - - assign highwayclass_basefactor - if ismainroad then - switch highway=trunk|trunk_link 1.8 switch highway=primary|primary_link 1.5 - switch highway=secondary|secondary_link 1.2 switch highway=tertiary|tertiary_link 1.1 1.0 - else if istrack then - switch highway=track 1.0 switch highway=path 1.1 switch highway=footway 1.2 1.0 # highway=road - else - switch highway=pedestrian 2.0 switch highway=bridleway 3.0 - switch highway=cycleway 1.0 switch highway=residential|living_street 1.0 - switch highway=service 1.1 cost_of_unknown - - - assign tracktype_penalty - if tracktype= then 0.0 else - switch tracktype=grade1 0.0 switch tracktype=grade2 0.4 switch tracktype=grade3 0.7 - switch tracktype=grade4 0.9 switch tracktype=grade5 1.0 0.5 - - assign surface_penalty - if nosurface then 0.0 else - switch surface=asphalt|paved 0.0 switch surface=concrete|paving_stones 0.2 - switch surface=sett|compacted 0.4 switch surface=cobblestone|ground|earth|unpaved|dirt|fine_gravel 0.6 - switch surface=grass|sand 1.0 switch surface=gravel|pebblestone 1.5 0.6 - - assign tracktype_surface_penalty - if nosurfacenortracktype then ( switch ismainroad 0.0 switch isotherroad 0.0 switch highway=path 0.8 0.4 ) - else if nosurface then tracktype_penalty - else if tracktype= then surface_penalty else - max tracktype_penalty surface_penalty - - assign not_isbike_penalty if isbike then 0.0 - else if ismainroad then - add switch bicycle=use_sidepath 2.0 0.0 - switch highway=trunk|trunk_link 8.2 switch highway=primary|primary_link 1.5 - switch highway=secondary|secondary_link 0.4 0.3 # tertiary|tertiary_link|unclassified - else if istrack then - switch highway=footway 3.5 switch or ispaved tracktype=grade1 0.0 - switch and tracktype= not isunpaved ( switch highway=path 3.5 1.0 ) - switch tracktype= 3.0 switch tracktype=grade1 0.2 - switch tracktype=grade2 0.6 switch tracktype=grade3 1.2 - switch tracktype=grade4 2.0 switch tracktype=grade5 3.0 - 3.0 - else - switch highway=pedestrian 2.0 switch highway=bridleway 2.0 - switch highway=cycleway 0.0 switch highway=residential|living_street 0.0 - switch highway=service 0.0 0.0 - - assign wet_penalty if not iswet then 0.0 else - switch surface=cobblestone|sett 1.0 switch ispaved 0.0 - switch surface=compacted 0.6 switch surface=fine_gravel 0.8 - switch surface= switch not istrack 0.5 switch highway=path 2.0 1.0 - switch surface=grass switch highway=path 2.5 1.5 - switch surface=ground|earth|unpaved|sand|dirt|mud switch highway=path 3.5 2.0 - 2.0 - - # bend /HWclass_bfactor_components - - # bend /roadmaxpenalties - - # bstart /trafficpenalties - # Penalty for unsafe roads. As wet fallback, it does not so strictly avoid unsafe - assign unsafe_penalty - if and avoid_unsafe and ismainroad not isbike - then multiply unsafe_penalty_value ( if iswet then 0.5 else 1.0 ) - else 0.0 - - - - assign trafficpenalty0 = ( - if not allow_traffic_penalty then 0.0 else - if highway=primary|primary_link then - ( - if estimated_traffic_class=4 then 0.2 - else if estimated_traffic_class=5 then 0.4 - else if estimated_traffic_class=6|7 then 0.6 - else 0 - ) - else if highway=secondary|secondary_link then - ( - if estimated_traffic_class=3 then 0.2 - else if estimated_traffic_class=4 then 0.4 - else if estimated_traffic_class=5 then 0.6 - else if estimated_traffic_class=6|7 then 1 - else 0 - ) - else if highway=tertiary|tertiary_link then - ( - if estimated_traffic_class=2 then 0.1 - else if estimated_traffic_class=3 then 0.3 - else if estimated_traffic_class=4 then 0.5 - else if estimated_traffic_class=5|6|7 then 1 - else 0 - ) +# Poutnik's Trekking profile template for Trekking profile variants +# Version 2.6.* new max cost system +# +# *) = See also https://github.com/poutnikl/Brouter-profiles/wiki +# **) = See also https://github.com/poutnikl/Trekking-Poutnik/wiki +# +# MTB profile, based on MTBiker feedback +# +# Legend above is the placeholder for generated comments of final profiles +# See the HistoryLog.txt file for file history, the wikis above for verbose comments. + +# bstart /global +---context:global +assign iswet 0 # 0 as default, *) flag for weather conditions +assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style +assign cycleroutes_pref 0.2 # also CRP *) costfactor penalty for not being cycleroute +assign MTB_factor 2.0 # default 0.0, *) +assign smallpaved_factor -0.5 # default 0.0, *) +assign avoid_unsafe 0 # 0 as default, gives penalty to mainroad without bike friendly status. +assign hills 1 # 1=default / 0=BRouter default/ 1=+ penalty for uphills >3.0%/ 2=velomobile-like avoiding slopes, 3= simulates ascend/length time equiv. + # 4=valley mode, 5=No-Flats mode +assign isbike_for_mainroads true # default=true / if false then bike friendly tag hints for mainroads are ignored, keeping their high penalties. v2.5.20 +assign path_preference 0.0 # 0.0 as default, try 20.0 to penalize nonpath ways a/o paved ways + +assign consider_elevation 1 # 1 as default +assign consider_smoothness 1 # 1 as default +assign allow_steps 1 # 1 as default +assign allow_ferries 1 # 1 as default +assign allow_traffic_penalty 1 # 1 as default + +assign StrictNOBicycleaccess 0 # 0 allows but penalizes foot only access / 1 forbides foot only access. +assign valley_nonflat_multiplier = 2.0 + +assign allow_default_barrier_restriction false # If true, default access for barrier=gate is false. see node context + +# Internal parameters - not intended to be tweaked by end users, unless they know what they are doing. + +#new in 2.5.12 + +assign NoFlatMode equal hills 5 +assign ValleyMode equal hills 4 +assign originalisbike false + +assign uphillcostvalue switch equal hills 1 70 switch equal hills 2 80 + switch equal hills 3 60 switch ValleyMode 150 switch NoFlatMode 0 0 +assign uphillcutoffvalue switch equal hills 1 3.0 switch equal hills 2 1.0 + switch equal hills 3 0.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 +assign downhillcutoffvalue switch equal hills 1 1.5 switch equal hills 2 0.5 + switch equal hills 3 1.5 switch ValleyMode 1.5 switch NoFlatMode 1.5 1.5 +assign downhillcostvalue switch equal hills 1 60 switch equal hills 2 80 + switch equal hills 3 0 switch ValleyMode 150 switch NoFlatMode 0 0 + +assign Flat_Penalty if NoFlatMode then 1.5 else 0.0 + +assign validForBikes 1 +assign processUnusedTags 0 # 1 is old Brouter behaviour, 0 is new Brouter default, more efficient, but ignores tags not used by a profile. + + +# positive smallpaved factor effect subtracts itself from MTB factor effect +# on MTB-like OSM way preference and elevation effect attenuation + +#v2.5.14 assign MTBminusSP_factor sub MTB_factor ( max 0 smallpaved_factor ) - pre v2.5.14 + +#v2.5.14 +assign Hill_factor min 3 max -3 sub MTB_factor smallpaved_factor +assign Road_factor min 3 max -3 ( sub ( sub 0.0 MTB_factor ) smallpaved_factor ) + +assign positive_smallpaved_factor not lesser smallpaved_factor 0.0 +assign abs_smallpaved_factor multiply ( switch positive_smallpaved_factor 1.0 -1.0 ) smallpaved_factor + +assign MTB_hillcostfactor multiply 0.3333 Hill_factor + # It changes hillcosts to be 0.0 at Hill_factor = 3.0 and twice at -3.0 + # Hill_factor 1..-1 leads hillcost to decrease e.g. from 60 to 40 / increase from 60 to 80 + +assign downhillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) downhillcostvalue ) else 0 +assign uphillcost if ( consider_elevation ) then ( multiply ( sub 1.0 MTB_hillcostfactor ) uphillcostvalue ) else 0 +assign uphillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) uphillcutoffvalue ) else 1.5 +assign downhillcutoff if ( consider_elevation ) then ( multiply ( max 0.0 min 1.0 add 1.0 MTB_hillcostfactor ) downhillcutoffvalue ) else 1.5 + +assign elevationpenaltybuffer if ValleyMode then 10 else 5 # 5 is trekking default +assign elevationmaxbuffer if ValleyMode then 20 else 10 # 10 is trekking default +assign elevationbufferreduce if ValleyMode then 0.0 else ( multiply 0.333 max uphillcutoff downhillcutoff ) # 0.0 is trekking default + +assign uphillCFshift 0.0 # experimental shifting of up/downhillcostfactors as alternative way of +assign downhillCFshift 0.0 # prioritizing/penalizing of up/downhills, based on length, not elevation + +assign pass1coefficient 1.8 +assign pass2coefficient 0 + +assign use_proposed_cn 1 # 0 as default, considers proposed cycle networks as unmarked but valid cycleroutes. +assign considerTurnRestrictions = true #v2.5.11 + +assign unsafe_penalty_value 1.0 # 1 - was 2 in Trekking, but this may cause U-like safe routes +assign cost_of_unknown 2.0 # 2 as default, cost of highway= + +assign c_ford_initialcost_node = 500 +assign c_ford_initialcost_way = 1000 +assign c_ford_costfactor = 50 +assign million = 1000000 + +assign ford_handling_coef + switch ( lesser Hill_factor -1.49 ) million switch ( lesser Hill_factor -0.99 ) 20 + switch ( lesser Hill_factor -0.49 ) 5.0 switch ( lesser Hill_factor 0.01 ) 1.0 + switch ( lesser Hill_factor 0.51 ) 0.4 switch ( lesser Hill_factor 1.01 ) 0.1 + switch ( lesser Hill_factor 1.51 ) 0.05 0.0 + +assign ford_initialcost_way = if ( equal ford_handling_coef million ) then million else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_initialcost_way ford_handling_coef + +assign ford_initialcost_node = if ( equal ford_handling_coef million ) then million else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_initialcost_node ford_handling_coef + +assign ford_costfactor = if ( equal ford_handling_coef million ) then 9999 else + if ( equal ford_handling_coef 0.0 ) then 0.0 else + multiply c_ford_costfactor ford_handling_coef + +assign UDcostON true + +assign ncncoef max 0 min 1 multiply cycleroutes_pref 0.2 +assign lcncoef max 0 min 1 multiply cycleroutes_pref 1.0 + +# bend /global +# bstart /way +---context:way # following code refers to way-tags +# bstart /wayvariables +assign isicn route_bicycle_icn=yes +assign isncn or route_bicycle_ncn=yes ncn=yes +assign isrcn or route_bicycle_rcn=yes rcn=yes +assign islcn or route_bicycle_lcn=yes lcn=yes + +assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes + +assign any_cn_yes or lcn=yes or rcn=yes ncn=yes +assign any_cn_proposed or lcn=proposed or rcn=proposed ncn=proposed +assign any_cn or any_cn_yes switch use_proposed_cn any_cn_proposed 0 + +assign nodeaccessgranted or any_cycleroute any_cn + +assign is_ldcr if ( equal cycleroutes_pref 0.0 ) then false else nodeaccessgranted + +assign istrack highway=track|road|path|footway +assign ismainroad highway=motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified +assign isotherroad = not or istrack ismainroad + +assign hascycleway = not + and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) ( or cycleway:right= cycleway:right=no ) + +#2.6.* inserted originalisbike option +assign isbike_candidate or bicycle=yes|permissive|designated or hascycleway + if originalisbike then lcn=yes else nodeaccessgranted + +assign isbike and ( or ( not ismainroad ) isbike_for_mainroads ) isbike_candidate + + +assign ispaved surface=paved|asphalt|concrete|paving_stones +assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone + +assign probablyGood or ispaved and isbike not isunpaved #probably good surface - weather independent + +assign turncost if ismainroad then 90 else if ispaved then 60 else 30 +# Turn cost is based solely on estimation of road speediness and eventual time cost of turning, partially promoting tracks ) + +assign ismuddy and iswet + and ( not surface=gravel|pebblestone ) # ***) + ( or isunpaved ( and surface= and highway=track|path not tracktype=grade1 ) ) + +assign nosurface or surface= surface=unknown +assign nosurfacenortracktype and nosurface tracktype= +assign ishard or ispaved surface=cobblestone|sett|compacted|fine_gravel|gravel|pebblestone +assign issoft not or nosurface ishard + +# bend /wayvariables + + +# bstart /initialcost +assign initialclassifier +if route=ferry then 1 +else if ( ford=yes ) then 15 +else if ( highway=motorway|motorway_link ) then 2 +else if ( highway=trunk|trunk_link ) then 3 +else if ( highway=primary|primary_link ) then 4 +else if ( highway=secondary|secondary_link ) then 5 +else if ( highway=tertiary|tertiary_link ) then 6 +else if ( highway=unclassified ) then 7 +else if ( highway=residential ) then 8 +else if ( highway=living_street ) then 9 +else if ( highway=service ) then 10 +else if ( highway=footway ) then 11 +else if ( istrack ) then 12 +else if ( highway=cycleway ) then 13 + else 14 + +assign initialcost +if route=ferry then 10000 +else if ( ford=yes ) then ford_initialcost_way +else if ( highway=motorway|motorway_link|trunk|trunk_link ) then 500 +else if ( highway=primary|primary_link ) then 120 +else if ( highway=secondary|secondary_link ) then 80 +else if ( highway=tertiary|tertiary_link|unclassified ) then 50 +else 30 + +# bend /initialcost + +# bstart /wayaccess + +assign defaultaccess = + if access= then not motorroad=yes + else if access=private|no then false + else true + +assign bikeaccess = + if nodeaccessgranted then true + else if hascycleway then true + else if bicycle= then ( if vehicle= then defaultaccess else not vehicle=private|no ) + else not bicycle=private|no|dismount + +assign footaccess = + if bikeaccess then true + else if bicycle=dismount then true + else if foot= then defaultaccess + else not foot=private|no + +assign accesspenalty = + if bikeaccess then 0 + else if footaccess then + ( if StrictNOBicycleaccess then 10000 else 4 ) + else 10000 + +# handle one-ways. On primary roads, wrong-oneways should be close to forbidden +# while on other ways we just add 4 to the costfactor +# making it at least 5, as you are allowed to push your bike. + +assign badoneway = + if reversedirection=yes then + if oneway:bicycle=yes then true + else if oneway= then junction=roundabout + else oneway=yes|true|1 + else oneway=-1 + +assign onewaypenalty = + if ( badoneway ) then + if cycleway=opposite|opposite_lane|opposite_track then 0 + else if oneway:bicycle=no then 0 + else if highway=primary|primary_link then 50 + else if highway=secondary|secondary_link then 30 + else if highway=tertiary|tertiary_link then 20 + else 4.0 + + else 0.0 + +# bend /wayaccess + +# bstart /roadmaxpenalties + +# bstart /roughness_penalty +assign smoothness_penalty +# http://wiki.openstreetmap.org/wiki/Key:smoothness + +if not consider_smoothness then 0.0 else +if smoothness= then 0.0 else +if smoothness=excellent|very_good|good then 0.0 else +if smoothness=intermediate then 0.2 else +if smoothness=bad|robust_wheels then 0.5 else +if smoothness=very_bad|high_clearance then 1.2 else +if smoothness=horrible|off_road_wheels then 2.5 else +if smoothness=very_horrible then 5.0 else +if smoothness=impassable then 10.0 else +0.0 + +assign mtb_scale_penalty if not consider_smoothness then 0.0 else + +# Remember this is for trekking bikes, not MTB. There are MTB dedicated profiles. +# http://wiki.openstreetmap.org/wiki/Key:mtb:scale + +if mtb:scale= then 0.0 else if mtb:scale=0- then 0.0 else +if mtb:scale=0 then 0.0 else if mtb:scale=0+ then 0.3 else +if mtb:scale=1- then 0.7 else if mtb:scale=1 then 1.2 else +if mtb:scale=1+ then 1.8 else if mtb:scale=2- then 2.5 else +if mtb:scale=2 then 5.0 else if mtb:scale=2+ then 10.0 else +if mtb:scale=3 then 15.0 else +if mtb:scale=4|5|6 then 9000 + else 0.0 + +assign roughness_penalty max smoothness_penalty max mtb_scale_penalty ( if ford=yes then ford_costfactor else 0 ) + +# bend /roughness_penalty + +# bstart /MTB_SP_tweaks + +assign rough_coef = add 1.0 ( multiply 0.33 roughness_penalty ) + +assign univ_factor_coef + switch highway=motorway|motorway_link|trunk|trunk_link 1.0 switch highway=primary|primary_link 0.9 + switch highway=secondary|secondary_link 0.7 switch highway=tertiary|tertiary_link 0.4 + switch highway=unclassified 0.25 + switch or not istrack highway=footway ( switch ispaved 0.25 switch isunpaved -0.25 0.0 ) + switch or ispaved tracktype=grade1 0.1 + multiply rough_coef + add ( switch highway=path -0.25 0.0 ) + switch ( nosurfacenortracktype ) ( switch isbike 0.0 -0.25 ) + switch nosurface ( switch or isbike tracktype=grade2|grade3 -0.25 -0.5 ) + switch surface=compacted|fine_gravel -0.25 switch surface=cobblestone|sett -0.4 + switch surface=ground|mud|dirt -0.6 switch surface=grass|sand -0.6 + switch surface=gravel|pebblestone -0.75 -0.6 + +assign nonpath_penalty = + if equal path_preference 0.0 then 0.0 # nonpath_penalty inactive + else multiply ( max 0 path_preference ) + if ismainroad then 1 else if not or istrack highway=cycleway then 0.6 + else if ispaved then 0.4 else if or not highway=path or not isunpaved tracktype=grade1|grade2 then 0.25 + else if or not isunpaved or not highway=path or not tracktype=grade3|grade4|grade5 + surface=gravel|cobblestone|pebblestone then 0.15 else 0.0 + +assign MTB_factor_for_road if ( equal MTB_factor 0.0 ) then 0.0 else multiply MTB_factor univ_factor_coef +assign abs_univ_factor if lesser univ_factor_coef 0.0 then multiply -1.0 univ_factor_coef else univ_factor_coef +assign smallpaved_factor_for_road if ( equal smallpaved_factor 0.0 ) then 0.0 + else multiply abs_smallpaved_factor ( if positive_smallpaved_factor then abs_univ_factor else ( sub 1.0 abs_univ_factor ) ) +# bend /MTB_SP_tweaks + +# bstart /HWclass_bfactor_components + +assign highwayclass_basefactor + if ismainroad then + switch highway=trunk|trunk_link 1.8 switch highway=primary|primary_link 1.5 + switch highway=secondary|secondary_link 1.2 switch highway=tertiary|tertiary_link 1.1 1.0 + else if istrack then + switch highway=track 1.0 switch highway=path 1.1 switch highway=footway 1.2 1.0 # highway=road + else + switch highway=pedestrian 2.0 switch highway=bridleway 3.0 + switch highway=cycleway 1.0 switch highway=residential|living_street 1.0 + switch highway=service 1.1 cost_of_unknown + + +assign tracktype_penalty + if tracktype= then 0.0 else + switch tracktype=grade1 0.0 switch tracktype=grade2 0.4 switch tracktype=grade3 0.7 + switch tracktype=grade4 0.9 switch tracktype=grade5 1.0 0.5 + +assign surface_penalty + if nosurface then 0.0 else + switch surface=asphalt|paved 0.0 switch surface=concrete|paving_stones 0.2 + switch surface=sett|compacted 0.4 switch surface=cobblestone|ground|earth|unpaved|dirt|fine_gravel 0.6 + switch surface=grass|sand 1.0 switch surface=gravel|pebblestone 1.5 0.6 + +assign tracktype_surface_penalty + if nosurfacenortracktype then ( switch ismainroad 0.0 switch isotherroad 0.0 switch highway=path 0.8 0.4 ) + else if nosurface then tracktype_penalty + else if tracktype= then surface_penalty else + max tracktype_penalty surface_penalty + +assign not_isbike_penalty if isbike then 0.0 + else if ismainroad then + add switch bicycle=use_sidepath 2.0 0.0 + switch highway=trunk|trunk_link 8.2 switch highway=primary|primary_link 1.5 + switch highway=secondary|secondary_link 0.4 0.3 # tertiary|tertiary_link|unclassified + else if istrack then + switch highway=footway 3.5 switch or ispaved tracktype=grade1 0.0 + switch and tracktype= not isunpaved ( switch highway=path 3.5 1.0 ) + switch tracktype= 3.0 switch tracktype=grade1 0.2 + switch tracktype=grade2 0.6 switch tracktype=grade3 1.2 + switch tracktype=grade4 2.0 switch tracktype=grade5 3.0 + 3.0 + else + switch highway=pedestrian 2.0 switch highway=bridleway 2.0 + switch highway=cycleway 0.0 switch highway=residential|living_street 0.0 + switch highway=service 0.0 0.0 + +assign wet_penalty if not iswet then 0.0 else + switch surface=cobblestone|sett 1.0 switch ispaved 0.0 + switch surface=compacted 0.6 switch surface=fine_gravel 0.8 + switch surface= switch not istrack 0.5 switch highway=path 2.0 1.0 + switch surface=grass switch highway=path 2.5 1.5 + switch surface=ground|earth|unpaved|sand|dirt|mud switch highway=path 3.5 2.0 + 2.0 + +# bend /HWclass_bfactor_components + +# bend /roadmaxpenalties + +# bstart /trafficpenalties +# Penalty for unsafe roads. As wet fallback, it does not so strictly avoid unsafe +assign unsafe_penalty + if and avoid_unsafe and ismainroad not isbike + then multiply unsafe_penalty_value ( if iswet then 0.5 else 1.0 ) + else 0.0 + + + +assign trafficpenalty0 = ( + if not allow_traffic_penalty then 0.0 else + if highway=primary|primary_link then + ( + if estimated_traffic_class=4 then 0.2 + else if estimated_traffic_class=5 then 0.4 + else if estimated_traffic_class=6|7 then 0.6 else 0 - ) - - assign trafficpenalty = - if hascycleway then min 0.3 trafficpenalty0 - else trafficpenalty0 - - # bend /trafficpenalties - - # bstart /costfactors - - assign penaltymax = max roughness_penalty max tracktype_surface_penalty max wet_penalty trafficpenalty - - assign rawcostfactor ( # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor - switch and highway= not route=ferry 10000 #only highways unless ferry - switch highway=motorway|motorway_link|proposed|abandoned 10000 - - # all other exclusions below (access, steps, ferries,..) should not be deleted by the decoder, to be available in voice-hint-processing - min 9999 - - switch highway=steps switch allow_steps 40 10000 - switch route=ferry switch allow_ferries 5.67 10000 - switch highway=construction 10000 - - add highwayclass_basefactor add not_isbike_penalty add unsafe_penalty max penaltymax nonpath_penalty - ) - - assign isCFgt9997 greater rawcostfactor 9997 - - assign LDCRboost multiply sub 1.0 rawcostfactor cycleroutes_pref - assign cycleroute_tweak - #2.6 reworked : non cyclenetwork penalty = + cycleroutes_pref ( 0..1 , default 0.2) - # ICN boost = - ( CF - 1 ) * cycleroutes_pref, leading to CF=1.0 for cycleroutes_pref = 1.0 - # other CN: weitgted average of above, with weights ncncoef, lcncoef shifting with cycleroutes_pref - - if not greater cycleroutes_pref 0.0 then 0.0 - else if not is_ldcr then cycleroutes_pref - else if isicn then LDCRboost - else if isncn then add multiply ncncoef cycleroutes_pref multiply ( sub 1.0 ncncoef ) LDCRboost - else add multiply lcncoef cycleroutes_pref multiply ( sub 1.0 lcncoef ) LDCRboost - - # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor - assign rawcostfactor2 if isCFgt9997 then rawcostfactor - else add rawcostfactor add cycleroute_tweak add MTB_factor_for_road smallpaved_factor_for_road - - assign access-penalty max onewaypenalty accesspenalty - - assign costfactor if isCFgt9997 then rawcostfactor2 else add access-penalty add Flat_Penalty max 1.0 rawcostfactor2 - - assign uphillcostfactor if or not UDcostON isCFgt9997 then costfactor else - add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) - else add uphillCFshift add rawcostfactor2 switch ismainroad ( multiply 0.4 sub univ_factor_coef 0.5 ) ( multiply -0.5 univ_factor_coef ) - - assign downhillcostfactor if or not UDcostON isCFgt9997 then costfactor else - add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) - else add downhillCFshift add rawcostfactor2 multiply -0.2 univ_factor_coef - - # bend /costfactors - - # bstart /priorityclassifiers - - # way priorities used for voice hint generation - - assign priorityclassifier = ( - - if ( highway=motorway ) then 30 - else if ( highway=motorway_link ) then 29 - else if ( highway=trunk ) then 28 - else if ( highway=trunk_link ) then 27 - else if ( highway=primary ) then 26 - else if ( highway=primary_link ) then 25 - else if ( highway=secondary ) then 24 - else if ( highway=secondary_link ) then 23 - else if ( highway=tertiary ) then 22 - else if ( highway=tertiary_link ) then 21 - else if ( highway=unclassified ) then 20 - else if ( highway=residential|living_street ) then 16 - else if ( highway=service ) then 14 - else if ( tracktype=grade1 ) then 6 - else if ( highway=cycleway ) then 6 - else if ( bicycle=designated ) then 6 - else if ( highway=bridleway ) then 4 - else if ( highway=track|road|footway ) then 4 - else if ( highway=steps|path|pedestrian ) then 2 + ) + else if highway=secondary|secondary_link then + ( + if estimated_traffic_class=3 then 0.2 + else if estimated_traffic_class=4 then 0.4 + else if estimated_traffic_class=5 then 0.6 + else if estimated_traffic_class=6|7 then 1 + else 0 + ) + else if highway=tertiary|tertiary_link then + ( + if estimated_traffic_class=2 then 0.1 + else if estimated_traffic_class=3 then 0.3 + else if estimated_traffic_class=4 then 0.5 + else if estimated_traffic_class=5|6|7 then 1 + else 0 + ) else 0 ) + +assign trafficpenalty = + if hascycleway then min 0.3 trafficpenalty0 + else trafficpenalty0 + +# bend /trafficpenalties + +# bstart /costfactors - # some more classifying bits used for voice hint generation... +assign penaltymax = max roughness_penalty max tracktype_surface_penalty max wet_penalty trafficpenalty - assign isbadoneway = not equal onewaypenalty 0 - assign isgoodoneway = if reversedirection=yes then oneway=-1 - else if oneway= then junction=roundabout else oneway=yes|true|1 - assign isroundabout = junction=roundabout - assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link - assign isgoodforcars = if greater priorityclassifier 6 then true - else if highway=residential|living_street|service then true - else if ( and highway=track tracktype=grade1 ) then true - else false +assign rawcostfactor ( # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor + switch and highway= not route=ferry 10000 #only highways unless ferry + switch highway=motorway|motorway_link|proposed|abandoned 10000 + + # all other exclusions below (access, steps, ferries,..) should not be deleted by the decoder, to be available in voice-hint-processing + min 9999 + + switch highway=steps switch allow_steps 40 10000 + switch route=ferry switch allow_ferries 5.67 10000 + switch highway=construction 10000 + + add highwayclass_basefactor add not_isbike_penalty add unsafe_penalty max penaltymax nonpath_penalty + ) - # ... encoded into a bitmask + assign isCFgt9997 greater rawcostfactor 9997 + + assign LDCRboost multiply sub 1.0 rawcostfactor cycleroutes_pref + assign cycleroute_tweak + #2.6 reworked : non cyclenetwork penalty = + cycleroutes_pref ( 0..1 , default 0.2) + # ICN boost = - ( CF - 1 ) * cycleroutes_pref, leading to CF=1.0 for cycleroutes_pref = 1.0 + # other CN: weitgted average of above, with weights ncncoef, lcncoef shifting with cycleroutes_pref - assign classifiermask add isbadoneway - add multiply isgoodoneway 2 - add multiply isroundabout 4 - add multiply islinktype 8 - multiply isgoodforcars 16 + if not greater cycleroutes_pref 0.0 then 0.0 + else if not is_ldcr then cycleroutes_pref + else if isicn then LDCRboost + else if isncn then add multiply ncncoef cycleroutes_pref multiply ( sub 1.0 ncncoef ) LDCRboost + else add multiply lcncoef cycleroutes_pref multiply ( sub 1.0 lcncoef ) LDCRboost + + # can be <1, adjusted to >=1 in final step of calculation of costfactor, uphillcostfactor,downhillcostfactor + assign rawcostfactor2 if isCFgt9997 then rawcostfactor + else add rawcostfactor add cycleroute_tweak add MTB_factor_for_road smallpaved_factor_for_road + + assign access-penalty max onewaypenalty accesspenalty - # bend /priorityclassifiers + assign costfactor if isCFgt9997 then rawcostfactor2 else add access-penalty add Flat_Penalty max 1.0 rawcostfactor2 + + assign uphillcostfactor if or not UDcostON isCFgt9997 then costfactor else + add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) + else add uphillCFshift add rawcostfactor2 switch ismainroad ( multiply 0.4 sub univ_factor_coef 0.5 ) ( multiply -0.5 univ_factor_coef ) + + assign downhillcostfactor if or not UDcostON isCFgt9997 then costfactor else + add access-penalty max 1.0 if ValleyMode then ( multiply rawcostfactor2 valley_nonflat_multiplier ) + else add downhillCFshift add rawcostfactor2 multiply -0.2 univ_factor_coef + +# bend /costfactors - # bend /way +# bstart /priorityclassifiers - # bstart /node - ---context:node # following code refers to node tags +# way priorities used for voice hint generation - assign initial_cost_node 0 # 0 as default +assign priorityclassifier = ( - assign defaultaccess = - if ( access= ) then if allow_default_barrier_restriction then not barrier=gate # add default barrier restrictions here! - modified v2.5.15, conditioned in 2.6 - else true - else if ( access=private|no ) then false - else true + if ( highway=motorway ) then 30 + else if ( highway=motorway_link ) then 29 + else if ( highway=trunk ) then 28 + else if ( highway=trunk_link ) then 27 + else if ( highway=primary ) then 26 + else if ( highway=primary_link ) then 25 + else if ( highway=secondary ) then 24 + else if ( highway=secondary_link ) then 23 + else if ( highway=tertiary ) then 22 + else if ( highway=tertiary_link ) then 21 + else if ( highway=unclassified ) then 20 + else if ( highway=residential|living_street ) then 16 + else if ( highway=service ) then 14 + else if ( tracktype=grade1 ) then 6 + else if ( highway=cycleway ) then 6 + else if ( bicycle=designated ) then 6 + else if ( highway=bridleway ) then 4 + else if ( highway=track|road|footway ) then 4 + else if ( highway=steps|path|pedestrian ) then 2 + else 0 + ) + +# some more classifying bits used for voice hint generation... - assign bikeaccess = - if nodeaccessgranted=yes then true - else if bicycle= then - ( - if vehicle= then defaultaccess - else not vehicle=private|no - ) - else not bicycle=private|no|dismount +assign isbadoneway = not equal onewaypenalty 0 +assign isgoodoneway = if reversedirection=yes then oneway=-1 + else if oneway= then junction=roundabout else oneway=yes|true|1 +assign isroundabout = junction=roundabout +assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link +assign isgoodforcars = if greater priorityclassifier 6 then true + else if highway=residential|living_street|service then true + else if ( and highway=track tracktype=grade1 ) then true + else false - assign footaccess = - if bicycle=dismount then true - else if foot= then defaultaccess - else not foot=private|no +# ... encoded into a bitmask + +assign classifiermask add isbadoneway + add multiply isgoodoneway 2 + add multiply isroundabout 4 + add multiply islinktype 8 + multiply isgoodforcars 16 + +# bend /priorityclassifiers + +# bend /way + +# bstart /node +---context:node # following code refers to node tags + +assign initial_cost_node 0 # 0 as default + +assign defaultaccess = + if ( access= ) then if allow_default_barrier_restriction then not barrier=gate # add default barrier restrictions here! - modified v2.5.15, conditioned in 2.6 + else true + else if ( access=private|no ) then false + else true + +assign bikeaccess = + if nodeaccessgranted=yes then true + else if bicycle= then + ( + if vehicle= then defaultaccess + else not vehicle=private|no + ) + else not bicycle=private|no|dismount + +assign footaccess = + if bicycle=dismount then true + else if foot= then defaultaccess + else not foot=private|no - assign initialcost = - add ( if highway=traffic_signals then 120 - else if highway=stop then 60 - else if and highway=crossing bicycle=no then 60 - else if and highway=crossing crossing=no then 300 # workaround affecting road routing - else if ( ford=yes ) then ford_initialcost_node - else initial_cost_node ) - if bikeaccess then 0 else ( if footaccess then 100 else 1000000 ) +assign initialcost = + add ( if highway=traffic_signals then 120 + else if highway=stop then 60 + else if and highway=crossing bicycle=no then 60 + else if and highway=crossing crossing=no then 300 # workaround affecting road routing + else if ( ford=yes ) then ford_initialcost_node + else initial_cost_node ) + if bikeaccess then 0 else ( if footaccess then 100 else 1000000 ) - # bend /node +# bend /node diff --git a/misc/profiles2/rail-private.brf b/misc/profiles2/rail-private.brf new file mode 100644 index 0000000..c8ed079 --- /dev/null +++ b/misc/profiles2/rail-private.brf @@ -0,0 +1,22 @@ +---context:global # following code refers to global config + +# the elevation parameters + +assign downhillcost 0 +assign downhillcutoff 1.5 +assign uphillcost 0 +assign uphillcutoff 1.5 + +---context:way # following code refers to way-tags + +assign turncost 0 +assign initialcost 0 + +assign costfactor + switch railway=rail|light_rail|narrow_gauge 1 + switch railway=tram|subway 2 + 100000 + +---context:node # following code refers to node tags + +assign initialcost 0 diff --git a/misc/profiles2/river-private.brf b/misc/profiles2/river-private.brf new file mode 100644 index 0000000..80b46cc --- /dev/null +++ b/misc/profiles2/river-private.brf @@ -0,0 +1,21 @@ +---context:global # following code refers to global config + +# the elevation parameters + +assign downhillcost 0 +assign downhillcutoff 1.5 +assign uphillcost 0 +assign uphillcutoff 1.5 + +---context:way # following code refers to way-tags + +assign turncost 0 +assign initialcost 0 + +assign costfactor + switch or waterway=canal or waterway=river or waterway=fairway waterway=lock_gate 1 + 100000 + +---context:node # following code refers to node tags + +assign initialcost 0