Merge pull request #189 from Phyks/profile-variables

Let app and consumers of profiles edit variables
This commit is contained in:
abrensch 2019-10-05 16:46:38 +02:00 committed by GitHub
commit 3170f031cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 888 additions and 1080 deletions

View file

@ -94,6 +94,21 @@ More documentation of this is available in the
[`misc/readmes/mapcreation.md`](misc/readmes/mapcreation.md) file. [`misc/readmes/mapcreation.md`](misc/readmes/mapcreation.md) file.
### (Optional) Generate profile variants
This repository holds examples of BRouter profiles for many different
transportation modes. Most of these can be easily customized by setting
variables in the first `global` context of the profiles files.
An helper script is available in `misc/scripts/generate_profile_variants.sh`
to help you quickly generate variants based on the default profiles, to create
a default set of profiles covering most of the basic use cases.
Have a look at the
[`misc/readmes/profile_developers_guide.txt`](misc/readmes/profile_developers_guide.txt)
for an in-depth guide on profiles edition and customization.
### Run the BRouter HTTP server ### Run the BRouter HTTP server
Helpers scripts are provided in `misc/scripts/standalone` to quickly spawn a Helpers scripts are provided in `misc/scripts/standalone` to quickly spawn a

View file

@ -1,271 +0,0 @@
#
# Car-Routing based on a kinematic model
#
# Depending on the vmax-parameter (target-speed)
# this can be anything from least-time routing to eco-routing
#
#
---model:btools.router.KinematicModel
---context:global
# kinematic parameters
assign vmax = 90 # kmh
assign recup_efficiency = 0.7 # (ratio)
assign totalweight = 1640 # kg
assign f_roll = 232 # Newton
assign f_air = 0.4 # 0.5*cw*A*rho
assign f_recup = 400 # Newton
assign p_standby = 250 # Watt
# technical parameters
assign validForCars = true
assign pass1coefficient = 1.3
assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
assign avoid_toll = false # %avoid_toll% | Avoid paid roads | boolean
assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean
assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean
# classifier constants
assign classifier_none = 1
assign classifier_ferry = 2
---context:way # following code refers to way-tags
assign is_avoided_toll_road and avoid_toll toll=yes
assign is_avoided_motorway and avoid_motorways highway=motorway|motorway_link
#
# calculate logical car access
#
assign isresidentialorliving = or highway=residential|living_street living_street=yes
assign caraccess
switch motorcar=
switch motor_vehicle=
switch vehicle=
switch access=
switch highway=motorway|motorway_link 1
switch highway=trunk|trunk_link 1
switch highway=primary|primary_link 1
switch highway=secondary|secondary_link 1
switch highway=tertiary|tertiary_link 1
switch highway=unclassified 1
switch route=ferry 1
switch isresidentialorliving 1
switch highway=service 1
0
access=yes|permissive|designated|destination
vehicle=yes|designated|destination
motor_vehicle=yes|permissive|designated|destination
motorcar=yes|permissive|designated|destination
assign caraccess_destination
switch motorcar=
switch motor_vehicle=
switch vehicle=
access=destination
vehicle=destination
motor_vehicle=destination
motorcar=destination
#
# for any change in initialclassifier, initialcost is added once
#
assign initialclassifier =
if route=ferry then classifier_ferry
else classifier_none
#
# calculate the initial cost
# this is added to the total cost each time the costfactor
# changed
#
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
else 0
assign accessspeedlimit = if caraccess then 999 else 0
assign isbadoneway = if reversedirection=yes then ( if oneway= then junction=roundabout else oneway=yes|true|1 ) else oneway=-1
assign onewayspeedlimit = if isbadoneway then 0 else 999
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
assign maxspeed_surface =
switch or surface= surface=paved|asphalt|concrete 999
switch surface=paving_stones|cobblestone|sett 30
switch surface=fine_gravel ( switch avoid_unpaved 3 10 )
switch avoid_unpaved 1 2
assign maxspeed_tracktype =
switch tracktype= 999
switch tracktype=grade1 40
switch tracktype=grade2 ( switch avoid_unpaved 2 5 )
1
assign maxspeed_implicit =
switch highway=motorway 999
switch highway=motorway_link 130
switch highway=trunk 250
switch highway=trunk_link 100
switch highway=primary|primary_link 100
switch highway=secondary|secondary_link 90
switch highway=tertiary|tertiary_link 80
switch highway=unclassified 50
switch route=ferry 10
switch highway=bridleway 10
switch isresidentialorliving 30
switch highway=service 30
switch highway=track|road|path switch tracktype=grade1 30 5
0
assign maxspeed_forward =
switch maxspeed:forward=50 50
switch maxspeed:forward=30 30
switch maxspeed:forward=10 10
switch maxspeed:forward=20 20
switch maxspeed:forward=40 40
switch maxspeed:forward=60 60
switch maxspeed:forward=70 70
switch maxspeed:forward=80 80
switch maxspeed:forward=90 90
switch maxspeed:forward=100 100
switch maxspeed:forward=110 110
switch maxspeed:forward=120 120
switch maxspeed:forward=130 130
switch maxspeed:forward=urban 50
switch maxspeed:forward=rural 100
999
assign maxspeed_backward =
switch maxspeed:backward=50 50
switch maxspeed:backward=30 30
switch maxspeed:backward=10 10
switch maxspeed:backward=20 20
switch maxspeed:backward=40 40
switch maxspeed:backward=60 60
switch maxspeed:backward=70 70
switch maxspeed:backward=80 80
switch maxspeed:backward=90 90
switch maxspeed:backward=100 100
switch maxspeed:backward=110 110
switch maxspeed:backward=120 120
switch maxspeed:backward=130 130
switch maxspeed:backward=urban 50
switch maxspeed:backward=rural 100
999
assign maxspeed_explicit =
switch maxspeed=50 50
switch maxspeed=30 30
switch maxspeed=10 10
switch maxspeed=20 20
switch maxspeed=40 40
switch maxspeed=60 60
switch maxspeed=70 70
switch maxspeed=80 80
switch maxspeed=90 90
switch maxspeed=100 100
switch maxspeed=110 110
switch maxspeed=120 120
switch maxspeed=130 130
switch maxspeed=urban 50
switch maxspeed=rural 100
if reversedirection=yes then maxspeed_backward else maxspeed_forward
assign maxspeed =
min if is_avoided_toll_road then 0 else 999
min if is_avoided_motorway then 0 else 999
min onewayspeedlimit
min accessspeedlimit
min maxspeed_explicit
min maxspeed_implicit
min maxspeed_surface maxspeed_tracktype
assign costfactor = if equal maxspeed 0 then 10000 else 0
assign minspeed =
switch highway=motorway|motorway_link|trunk 75 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=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 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 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
add multiply isgoodforcars 16
add multiply isresidentialorliving 32
multiply caraccess_destination 64
---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=
not barrier=gate|bollard|lift_gate|cycle_barrier
access=yes|permissive|designated|destination
vehicle=yes|permissive|designated|destination
motor_vehicle=yes|permissive|designated|destination
motorcar=yes|permissive|designated|destination
assign initialcost =
switch and avoid_toll barrier=toll_booth 1000000
switch caraccess
0
1000000
assign maxspeed =
if or crossing=traffic_signals highway=traffic_signals
then
switch greater way:priorityclassifier 24 5
switch greater way:priorityclassifier 22 3
switch greater way:priorityclassifier 20 1
0
else if railway=level_crossing then 0
else 999

View file

@ -1,271 +0,0 @@
#
# Car-Routing based on a kinematic model
#
# Depending on the vmax-parameter (target-speed)
# this can be anything from least-time routing to eco-routing
#
#
---model:btools.router.KinematicModel
---context:global
# kinematic parameters
assign vmax = 160 # kmh
assign recup_efficiency = 0.7 # (ratio)
assign totalweight = 1640 # kg
assign f_roll = 232 # Newton
assign f_air = 0.4 # 0.5*cw*A*rho
assign f_recup = 400 # Newton
assign p_standby = 250 # Watt
# technical parameters
assign validForCars = true
assign pass1coefficient = 1.3
assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
assign avoid_toll = false # %avoid_toll% | Avoid paid roads | boolean
assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean
assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean
# classifier constants
assign classifier_none = 1
assign classifier_ferry = 2
---context:way # following code refers to way-tags
assign is_avoided_toll_road and avoid_toll toll=yes
assign is_avoided_motorway and avoid_motorways highway=motorway|motorway_link
#
# calculate logical car access
#
assign isresidentialorliving = or highway=residential|living_street living_street=yes
assign caraccess
switch motorcar=
switch motor_vehicle=
switch vehicle=
switch access=
switch highway=motorway|motorway_link 1
switch highway=trunk|trunk_link 1
switch highway=primary|primary_link 1
switch highway=secondary|secondary_link 1
switch highway=tertiary|tertiary_link 1
switch highway=unclassified 1
switch route=ferry 1
switch isresidentialorliving 1
switch highway=service 1
0
access=yes|permissive|designated|destination
vehicle=yes|designated|destination
motor_vehicle=yes|permissive|designated|destination
motorcar=yes|permissive|designated|destination
assign caraccess_destination
switch motorcar=
switch motor_vehicle=
switch vehicle=
access=destination
vehicle=destination
motor_vehicle=destination
motorcar=destination
#
# for any change in initialclassifier, initialcost is added once
#
assign initialclassifier =
if route=ferry then classifier_ferry
else classifier_none
#
# calculate the initial cost
# this is added to the total cost each time the costfactor
# changed
#
assign initialcost =
if ( equal initialclassifier classifier_ferry ) then 10000
else 0
assign accessspeedlimit = if caraccess then 999 else 0
assign isbadoneway = if reversedirection=yes then ( if oneway= then junction=roundabout else oneway=yes|true|1 ) else oneway=-1
assign onewayspeedlimit = if isbadoneway then 0 else 999
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
assign maxspeed_surface =
switch or surface= surface=paved|asphalt|concrete 999
switch surface=paving_stones|cobblestone|sett 30
switch surface=fine_gravel ( switch avoid_unpaved 3 10 )
switch avoid_unpaved 1 2
assign maxspeed_tracktype =
switch tracktype= 999
switch tracktype=grade1 40
switch tracktype=grade2 ( switch avoid_unpaved 2 5 )
1
assign maxspeed_implicit =
switch highway=motorway 999
switch highway=motorway_link 130
switch highway=trunk 250
switch highway=trunk_link 100
switch highway=primary|primary_link 100
switch highway=secondary|secondary_link 90
switch highway=tertiary|tertiary_link 80
switch highway=unclassified 50
switch route=ferry 10
switch highway=bridleway 10
switch isresidentialorliving 30
switch highway=service 30
switch highway=track|road|path switch tracktype=grade1 30 5
0
assign maxspeed_forward =
switch maxspeed:forward=50 50
switch maxspeed:forward=30 30
switch maxspeed:forward=10 10
switch maxspeed:forward=20 20
switch maxspeed:forward=40 40
switch maxspeed:forward=60 60
switch maxspeed:forward=70 70
switch maxspeed:forward=80 80
switch maxspeed:forward=90 90
switch maxspeed:forward=100 100
switch maxspeed:forward=110 110
switch maxspeed:forward=120 120
switch maxspeed:forward=130 130
switch maxspeed:forward=urban 50
switch maxspeed:forward=rural 100
999
assign maxspeed_backward =
switch maxspeed:backward=50 50
switch maxspeed:backward=30 30
switch maxspeed:backward=10 10
switch maxspeed:backward=20 20
switch maxspeed:backward=40 40
switch maxspeed:backward=60 60
switch maxspeed:backward=70 70
switch maxspeed:backward=80 80
switch maxspeed:backward=90 90
switch maxspeed:backward=100 100
switch maxspeed:backward=110 110
switch maxspeed:backward=120 120
switch maxspeed:backward=130 130
switch maxspeed:backward=urban 50
switch maxspeed:backward=rural 100
999
assign maxspeed_explicit =
switch maxspeed=50 50
switch maxspeed=30 30
switch maxspeed=10 10
switch maxspeed=20 20
switch maxspeed=40 40
switch maxspeed=60 60
switch maxspeed=70 70
switch maxspeed=80 80
switch maxspeed=90 90
switch maxspeed=100 100
switch maxspeed=110 110
switch maxspeed=120 120
switch maxspeed=130 130
switch maxspeed=urban 50
switch maxspeed=rural 100
if reversedirection=yes then maxspeed_backward else maxspeed_forward
assign maxspeed =
min if is_avoided_toll_road then 0 else 999
min if is_avoided_motorway then 0 else 999
min onewayspeedlimit
min accessspeedlimit
min maxspeed_explicit
min maxspeed_implicit
min maxspeed_surface maxspeed_tracktype
assign costfactor = if equal maxspeed 0 then 10000 else 0
assign minspeed =
switch highway=motorway|motorway_link|trunk 75 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=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 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 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
add multiply isgoodforcars 16
add multiply isresidentialorliving 32
multiply caraccess_destination 64
---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=
not barrier=gate|bollard|lift_gate|cycle_barrier
access=yes|permissive|designated|destination
vehicle=yes|permissive|designated|destination
motor_vehicle=yes|permissive|designated|destination
motorcar=yes|permissive|designated|destination
assign initialcost =
switch and avoid_toll barrier=toll_booth 1000000
switch caraccess
0
1000000
assign maxspeed =
if or crossing=traffic_signals highway=traffic_signals
then
switch greater way:priorityclassifier 24 5
switch greater way:priorityclassifier 22 3
switch greater way:priorityclassifier 20 1
0
else if railway=level_crossing then 0
else 999

View file

@ -9,35 +9,36 @@
---context:global ---context:global
# kinematic parameters # Car profile
assign vmax = 90 # kmh
assign recup_efficiency = 0.7 # (ratio)
assign totalweight = 1640 # kg
assign f_roll = 232 # Newton
assign f_air = 0.4 # 0.5*cw*A*rho
assign f_recup = 400 # Newton
assign p_standby = 250 # Watt
# technical parameters
assign validForCars = true assign validForCars = true
assign pass1coefficient = 1.3
assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
# Use the following switches to change behaviour
assign avoid_toll = false # %avoid_toll% | Avoid paid roads | boolean assign avoid_toll = false # %avoid_toll% | Avoid paid roads | boolean
assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean
assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean
# Kinematic model parameters
assign vmax = 90 # %vmax% | Target speed (in km/h) | number
assign recup_efficiency = 0.7 # %recup_efficiency% | (ratio) | number
assign totalweight = 1640 # %totalweight% | Total weight of the car (in kg) | number
assign f_roll = 232 # %f_roll% | Rolling friction (in Newton) | number
assign f_air = 0.4 # %f_air% | Drag force (in Newton / (m/s)^2), 0.5*cw*A*rho | number
assign f_recup = 400 # %f_recup% | Newton | number
assign p_standby = 250 # %p_standby% | Watt | number
# classifier constants # Turn instructions settings
assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style]
assign classifier_none = 1 # Technical parameters
assign classifier_ferry = 2 assign pass1coefficient = 1.3
---context:way # following code refers to way-tags ---context:way # following code refers to way-tags
# classifier constants
assign classifier_none = 1
assign classifier_ferry = 2
assign is_avoided_toll_road and avoid_toll toll=yes assign is_avoided_toll_road and avoid_toll toll=yes
assign is_avoided_motorway and avoid_motorways highway=motorway|motorway_link assign is_avoided_motorway and avoid_motorways highway=motorway|motorway_link

View file

@ -1,226 +0,0 @@
#
# A variant of fastbike with a slightly different treatment
# of trunks and motorway-bike-access. This seems to be more
# suitable for some countries like Japan or Australia
#
# In standard fastbike (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 version here has more formal access rules.
---context:global # following code refers to global config
# Use the following switches to change behaviour
# (1=yes, 0=no):
assign consider_elevation 1 # set to 0 to ignore elevation in routing
assign allow_steps 1 # set to 0 to disallow steps
assign allow_ferries 1 # set to 0 to disallow ferries
assign ignore_cycleroutes 0 # set to 1 for better elevation results
assign stick_to_cycleroutes 0 # set to 1 to just follow cycleroutes
assign avoid_unsafe 0 # set to 1 to avoid standard highways
assign turnInstructionMode 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
assign validForBikes 1
# the elevation parameters
assign downhillcost switch consider_elevation 60 0
assign downhillcutoff 1.5
assign uphillcost 0
assign uphillcutoff 1.5
---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 surface=paving_stones
assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone
assign turncost 90
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 =
if access= then
(
if motorroad=yes then false
else if highway=motorway|motorway_link then false
else true
)
else if access=private|no then false
else true
#
# calculate logical bike access
#
assign bikeaccess
or any_cycleroute
switch bicycle=
switch bicycle_road=yes
1
switch vehicle=
defaultaccess
switch or vehicle=private vehicle=no
0
1
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
100000
#
# 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 ( 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 6.0
)
else 0.0
assign isresidentialorliving = or highway=residential|living_street living_street=yes
assign costfactor
switch and highway= not route=ferry 10000
switch or highway=proposed highway=abandoned 10000
min 9999
add max onewaypenalty accesspenalty
switch or highway=motorway highway=motorway_link 1.5
switch or highway=trunk highway=trunk_link 1.5
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 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 or highway=track or highway=road or highway=path 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
---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

View file

@ -1,249 +0,0 @@
#
# A fastbike could be a racing bike or a speed pedelec.
# But also at night or in rainy whether you might want
# to fallback to this one.
#
# Structure is similar to trekking.brf, see this for documenation.
#
---context:global # following code refers to global config
# Use the following switches to change behaviour
# (1=yes, 0=no):
assign consider_elevation 1 # set to 0 to ignore elevation in routing
assign allow_steps 1 # set to 0 to disallow steps
assign allow_ferries 1 # set to 0 to disallow ferries
assign ignore_cycleroutes 0 # set to 1 for better elevation results
assign stick_to_cycleroutes 0 # set to 1 to just follow cycleroutes
assign avoid_unsafe 0 # set to 1 to avoid standard highways
assign turnInstructionMode 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style
assign validForBikes 1
# the elevation parameters
assign downhillcost switch consider_elevation 60 0
assign downhillcutoff 1.5
assign uphillcost 0
assign uphillcutoff 1.5
---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 surface=paving_stones
assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone
assign turncost = if junction=roundabout then 0
else 90
assign initialcost switch route=ferry 10000 0
#
# calculate logical bike access
#
assign bikeaccess =
if any_cycleroute then true
else if bicycle= then
(
if bicycle_road=yes then true
else if vehicle= then
(
if access= then not or motorroad=yes highway=footway
else if access=private|no then false
else true
)
else not vehicle=private|no
)
else not bicycle=private|no|dismount
#
# calculate logical foot access
#
assign footaccess =
if bikeaccess then true
else if bicycle=dismount then true
else if foot= then
(
if access= then not motorroad=yes
else if access=private|no then false
else true
)
else not foot=private|no
#
# if not bike-, but foot-acess, just a moderate penalty,
# otherwise access is forbidden
#
assign accesspenalty =
if bikeaccess then 0
else if footaccess then 6
else 100000
#
# 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 ( 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 6.0
)
else 0.0
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 hascycleway then min 0.3 trafficpenalty0
else trafficpenalty0
assign isresidentialorliving = or highway=residential|living_street living_street=yes
assign costfactor
switch and highway= not route=ferry 10000
switch or highway=proposed highway=abandoned 10000
min 9999
add max onewaypenalty accesspenalty
add trafficpenalty
switch or highway=motorway highway=motorway_link 10000
switch or highway=trunk highway=trunk_link 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 1.1
switch highway=pedestrian 10
switch highway=steps 1000
switch route=ferry 5.67
switch highway=bridleway 5
switch highway=cycleway|footway 1.3
switch isresidentialorliving switch isunpaved 10 1.2
switch highway=service switch isunpaved 10 1.2
switch or highway=track or highway=road or highway=path 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 1.3
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
---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

View file

@ -0,0 +1,372 @@
# "fastbike-verylowtraffic.brf" -- Version 20-09-2019
# This profile, developed by Ess Bee, is based on the "fastbike-lowtraffic" profile
# it is intended for road cyclists who ride alone and / or in the middle of the week: thus trucks and high traffic are avoided
# (cyclists in group at the weekend will rather use "fastbike.brf" or "fastbike-lowprofile.brf" as groups are better respected by cars and trucks)
#
# ==> where ever possible, choose:
# - an asphalted way (with good smoothness)
# - cycleways are prefered
# - on highway=tertiary, secondary or primary whithout any cycle_way:
# - avoid segments with maxspeed > 50 kmh (reduce the risk)
# - avoid segments with high-traffic
#
# The route is calculated using the taggs of the OSM map (such as highway, surface, smoothness, maxspeed, traffic_class...)
#
---context:global # following code refers to global config
# to generate turn instructions, adapt the mode by need
assign turnInstructionMode 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
# Use the following switches to change behaviour
# (1=yes, 0=no):
assign consider_elevation 0 # set to 1 to calculate an elevation_penalty in routing
assign avoid_path 0 # set to 1 to avoid path (a.e. to avoid conflicts with pedestrians!)
assign turnInstructionCatchingRange 8 # 2 turn instructions are generated only when distance > 8 m
assign turnInstructionRoundabouts = 1 # roundabout, "take exit N"
assign considerTurnRestrictions true # turn restrictions are considered
assign validForBikes 1
# the elevation parameters
assign downhillcost switch consider_elevation 60 0
assign downhillcutoff 1.5
assign uphillcost switch consider_elevation 100 0
assign uphillcutoff 1.5
---context:way # following code refers to way-tags
# when "cycleway" only on 1 side of the road, use it only if it is on the right side in the direction of travel!
assign cycleway_right if reversedirection=yes
then if cycleway:left=track|lane|shared_lane then 1 else 0
else if cycleway:right=track|lane|shared_lane then 1 else 0
assign any_cycleway or cycleway=track|lane|shared_lane|shared cycleway_right
# as soon it is supported in lookup, add ==> bicycle_road=yes in any_cycleway
# in relation with "route=bicycle" ?
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 surface=asphalt
assign isunpaved surface=unpaved|gravel|dirt|earth|ground|sand
assign isfine_gravel surface=fine_gravel|cobblestone|compacted|paving_stones
assign isconcrete surface=concrete
assign turncost = if junction=roundabout then 0
else 10
#
assign initialclassifier =
switch route=ferry 2 1
assign initialcost =
switch route=ferry 4999 0
#
# implicit access here just from the motorroad tag
# (implicit access rules from highway tag handled elsewhere)
#
assign defaultaccess
switch access=
not motorroad=yes
switch or access=private access=no
0
1
#
# calculate logical bike access
#
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
#
# 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
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 ( 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 6.0
)
else 0.0
assign surfacepenalty
switch highway=unclassified|service|track|road|path|footway|cycleway
switch surface=asphalt 0
switch surface=paved switch smoothness=good|excellent 0 0.1 # befestigte(harte)Oberfläsche
switch concrete=plates 1 # Betonplattenwege
switch surface=concrete|paving_stones|wood|metal 0.7 # Beton, Pflastersteine, Holz, Metall
switch surface=cobblestone 2 # Kopfsteinpflaster
switch concrete=lanes 3 # Betonspurplatten
switch surface=fine_gravel|compacted 4 # Splitt,verdichtete Oberfläsche
switch surface=sett|grass_paver 5 # behauene Pflastersteine, Rasengittersteine
switch surface=gravel|sand|pebblestone|unpaved 10 # Schotter, Sand, Kies, unbefestigt
switch surface=ground|grass|dirt|earth|mud|clay 25 # naturbelassene Oberfläsche, Gras, Schutz Schlamm...
# if "surface" is not defined, for service and road asphalt is probable
switch surface=
switch highway=service|road 0.1
# in some cases only smoothness is tagged but surface not!
switch smoothness=intermediate|good|excellent 0
# else, check if tracktype=grade1, then is probably paved, so middle penalty
switch tracktype=grade1 1.3
# if a cycleroute is defined, surface can not be horrible...
switch any_cycleroute 3.5 5
# surface not known yet?
5
# no "surface" penalty for other highways
0
assign tracktypepenalty
switch tracktype=grade2 1
switch tracktype=grade3 5
switch tracktype=grade4 15
switch tracktype=grade5 50 0
assign trafficpenalty =
if any_cycleway then 0
else
if highway=primary|primary_link then
(
if estimated_traffic_class=4 then 0.8
else if estimated_traffic_class=5 then 1
else if estimated_traffic_class=6|7 then 2
else 0.6
)
else if highway=secondary|secondary_link then
(
if estimated_traffic_class=3 then 0.3
else if estimated_traffic_class=4 then 0.7
else if estimated_traffic_class=5 then 1
else if estimated_traffic_class=6|7 then 1.5
else 0.2
)
else if highway=tertiary|tertiary_link then
(
if estimated_traffic_class=2 then 0.1
else if estimated_traffic_class=3 then 0.2
else if estimated_traffic_class=4 then 0.3
else if estimated_traffic_class=5|6|7 then 0.5
else 0.1
)
else 0
assign smoothnesspenalty =
switch smoothness=intermediate 0.2
switch smoothness=bad 0.8
switch smoothness=very_bad 1.5
switch smoothness=horrible 2.5 0
assign maxspeedpenalty =
switch or highway=primary highway=primary_link
# as soon "name" is supported in lookup, replace with "switch maxspeed= switch name= 2.2 1
switch maxspeed=50 0.2
switch any_cycleway 0.2
switch maxspeed=60 0.7
switch maxspeed=70 1.2
switch maxspeed=80 1.5
switch maxspeed=90 2.0
switch maxspeed=100 3.0
switch maxspeed=110 11
switch maxspeed=120 12
switch maxspeed=130 13
switch maxspeed= 2.2 0
switch or highway=secondary highway=secondary_link
# as soon "name" is supported in lookup, replace with "switch maxspeed= switch name= 0.9 0.2
switch maxspeed=50 0.1
switch any_cycleway 0.1
switch maxspeed=60 0.2
switch maxspeed=70 0.9
switch maxspeed=80 1.5
switch maxspeed=90 2
switch maxspeed=100 2.5
switch maxspeed=110 11
switch maxspeed=120 12
switch maxspeed=130 13
switch maxspeed= 0.9 0
switch or highway=tertiary highway=tertiary_link
# as soon "name" is supported in lookup, replace with "switch maxspeed= switch name= 0.2 0.1
switch maxspeed=50 0
switch maxspeed=60 0.1
switch any_cycleway 0.05
switch maxspeed=70 0.2
switch maxspeed=80 0.2
switch maxspeed=90 0.3
switch maxspeed=100 0.4
switch maxspeed=110 11
switch maxspeed=120 12
switch maxspeed=130 13
switch maxspeed= 0.2 0
0
# if bicycle=use_sidepath, then try to prefer the (hopefully!) existing sidepath with a penalty on this highway (only if avoid_path is not set)
assign usesidepathpenalty =
switch bicycle=use_sidepath switch avoid_path 0 0.5 0
# give a light advantage to highways with a relation cycleroute
assign nocycleway_penalty switch any_cycleroute 0 0.1
assign not_bicycle_designatedpenalty switch bicycle=designated 0 0.1
assign path_penalty if avoid_path then 1 else 0
assign costfactor
add surfacepenalty
add tracktypepenalty
add trafficpenalty
add smoothnesspenalty
add maxspeedpenalty
add usesidepathpenalty
add nocycleway_penalty
add not_bicycle_designatedpenalty
add path_penalty
switch or highway=proposed highway=abandoned 10000
min 9999
add max onewaypenalty accesspenalty
switch or highway=motorway highway=motorway_link 10000
switch or highway=trunk highway=trunk_link 30
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 1.1
switch highway=pedestrian 8
switch highway=steps 100
switch route=ferry 11
switch highway=bridleway 31
switch highway=cycleway 1
switch highway=living_street 1.2
switch highway=residential 1.4
switch highway=service 1.1
switch highway=track|road|path 1
switch highway=footway 1.7
19.9
# 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 23
else if ( highway=primary_link ) then 23
else if ( highway=secondary ) then 22
else if ( highway=secondary_link ) then 22
else if ( highway=tertiary ) then 21
else if ( highway=tertiary_link ) then 21
else if ( highway=unclassified ) then 6
else if ( highway=residential|living_street ) then 6
else if ( highway=service ) then 6
else if ( highway=cycleway ) then 6
else if ( bicycle=designated ) then 6
else if ( highway=track|road|path )
then if or surface=asphalt|paved|concrete|wood|metal tracktype=grade1 then 6 else 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 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 # no voice hint if 1 of the 2 possibilities is badoneway
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 railwaypenalty switch railway= 0 255
assign initialcost
add railwaypenalty
switch bikeaccess
0
switch footaccess
300
1000000

View file

@ -5,28 +5,52 @@
# #
# Structure is similar to trekking.brf, see this for documenation. # 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 ---context:global # following code refers to global config
# Bike profile
assign validForBikes = true
# Use the following switches to change behaviour # Use the following switches to change behaviour
# (1=yes, 0=no): 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 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 considerTurnRestrictions = false # %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
assign consider_traffic = false # %consider_traffic% | Set to true to avoid traffic | boolean
assign allow_motorways = false # %allow_motorways% | Set to true to allow motorways (useful in Asia / Oceania for example) | boolean
assign consider_elevation 1 # set to 0 to ignore elevation in routing # Change elevation parameters
assign allow_steps 1 # set to 0 to disallow steps assign consider_elevation = true # %consider_elevation% | Set to false to ignore elevation in routing | boolean
assign allow_ferries 1 # set to 0 to disallow ferries assign downhillcost = 60 # %downhillcost% | Cost for going downhill | number
assign ignore_cycleroutes 0 # set to 1 for better elevation results assign downhillcutoff = 1.5 # %downhillcutoff% | Gradients below this value in percents are not counted. | number
assign stick_to_cycleroutes 0 # set to 1 to just follow cycleroutes assign uphillcost = 0 # %uphillcost% | Cost for going uphill | number
assign avoid_unsafe 0 # set to 1 to avoid standard highways assign uphillcutoff = 1.5 # %uphillcutoff% | Gradients below this value in percents are not counted. | number
assign turnInstructionMode 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
assign validForBikes 1 assign downhillcost = if consider_elevation then downhillcost else 0
assign uphillcost = if consider_elevation then uphillcost else 0
# the elevation parameters # 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]
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 downhillcost switch consider_elevation 60 0
assign downhillcutoff 1.5
assign uphillcost 0
assign uphillcutoff 1.5
---context:way # following code refers to way-tags ---context:way # following code refers to way-tags
@ -47,30 +71,32 @@ assign initialcost switch route=ferry 10000 0
# #
assign defaultaccess assign defaultaccess
switch access= switch access=
not motorroad=yes (
if motorroad=yes then false
else if highway=motorway|motorway_link then false
else true
)
switch or access=private access=no switch or access=private access=no
0 false
1 true
# #
# calculate logical bike access # calculate logical bike access
# #
assign bikeaccess assign bikeaccess =
or any_cycleroute or any_cycleroute
switch bicycle= switch bicycle=
switch bicycle_road=yes switch bicycle_road=yes
1 true
switch vehicle= switch vehicle=
defaultaccess defaultaccess
switch or vehicle=private vehicle=no not vehicle=private|no
0
1
not or bicycle=private or bicycle=no bicycle=dismount not or bicycle=private or bicycle=no bicycle=dismount
# #
# calculate logical foot access # calculate logical foot access
# #
assign footaccess assign footaccess =
or bikeaccess or bikeaccess
or bicycle=dismount or bicycle=dismount
switch foot= switch foot=
@ -113,6 +139,44 @@ assign onewaypenalty =
) )
else 0.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 assign isresidentialorliving = or highway=residential|living_street living_street=yes
assign costfactor assign costfactor
@ -122,9 +186,10 @@ assign costfactor
min 9999 min 9999
add max onewaypenalty accesspenalty add max onewaypenalty accesspenalty
add trafficpenalty
switch or highway=motorway highway=motorway_link 10000 switch or highway=motorway highway=motorway_link switch allow_motorways 1.5 10000
switch or highway=trunk highway=trunk_link 10 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=primary highway=primary_link 1.2
switch or highway=secondary highway=secondary_link 1.1 switch or highway=secondary highway=secondary_link 1.1
switch or highway=tertiary highway=tertiary_link 1.0 switch or highway=tertiary highway=tertiary_link 1.0

View file

@ -0,0 +1,298 @@
# Profile for medium-level hiking
#
# See https://github.com/poutnikl/Brouter-profiles for
# more variants and poutnik's profile collection
# *** Based on Trekking profile, added flag driven customizations
# 10/6/2015 v1.7.2 BETA - Fixed general way access penalties
# See bottom for Changelog and verbose comments.
---context:global
assign consider_elevation 1 # 0 as default, otherwise less interesting flat roads are chosen.
assign shortest_way 0 # 0 as default
assign iswet 0 # 0 as default, 1 tries to prevent muddy boots and wet buttocks
assign prefer_hiking_routes 1 # 1 as default, gives penalty to way not being hiking route and cancels route turncost
assign stick_to_hiking_routes 0 # 0 as default, as above, but gives higher penalty costfactor + way/node initial costs
assign non_hiking_route_penalty 0.15 # 0.25 as default, used with prefer_hiking_routes
assign non_sticky_route_penalty 0.5 # 1.0 as default, used stick_to_hiking_routes #v1.5
#SAC - mountain hiking - see http://wiki.openstreetmap.org/wiki/Key:sac_scale
assign SAC_scale_limit 3 # 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 1 # 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.
#orientation/decision penalties, not used for preferred hiking routes
assign turncost_value 0 # 20 as default, not used now
assign initialcost_value 0 # 50 as default, 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 0.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
assign downhillcost switch consider_elevation downhillcostvalue 0
assign downhillcutoff switch consider_elevation downhillcutoffvalue 0
assign uphillcost switch consider_elevation uphillcostvalue 0
assign uphillcutoff switch consider_elevation uphillcutoffvalue 0
assign validForFoot 1
assign hr_preferred or prefer_hiking_routes stick_to_hiking_routes
#Penalizing SAC routes below (K1) and above(K2) preferred SAC scale
#see http://wiki.openstreetmap.org/wiki/Key:sac_scale
assign SAC_K1 0.1 # Penalizing of SAC levels below preferred
assign SAC_K2 0.6 # Penalizing of SAC levels above preferred
#all the 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 hr_preferred
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 not or sidewalk= or sidewalk=none sidewalk=no
assign turncost switch or shortest_way is_ldhr 0 turncost_value #v1.5
assign initialcost
switch route=ferry 10000
switch or shortest_way is_ldhr 0 switch stick_to_hiking_routes initialcost_value 0
assign defaultaccess switch access= not motorroad=yes switch or access=private access=no 0 1
assign footaccess or any_hiking_route
or issidewalk
switch foot= defaultaccess switch foot=private|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 and bikeaccess not foot=no
or bicycle=dismount
switch foot=
defaultaccess
not or foot=private foot=no
assign accesspenalty switch footaccess 0 switch bikeaccess 4 100000
#
#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=difficult_alpine_hiking then 6
else if or sac_scale=demanding_alpine_hiking mtb:scale=6 then 5
else if or sac_scale=alpine_hiking mtb:scale=5 then 4
else if or sac_scale=demanding_mountain_hiking mtb:scale=4 then 3
else if or sac_scale=mountain_hiking mtb:scale=3|2+ then 2
else if or sac_scale=hiking|T1-hiking|yes mtb:scale=2|1+|2- 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 costfactor
if shortest_way then ( add 1 accesspenalty ) else
add ( switch is_ldhr 0.0 # hiking route, no non-hiking road penalty
switch stick_to_hiking_routes non_sticky_route_penalty
switch prefer_hiking_routes non_hiking_route_penalty
0.0 # no hiking route preference
)
add accesspenalty
add SAC_scale_penalty
switch ( and highway= not route=ferry ) 100000
switch highway=steps ( switch allow_steps ( switch consider_elevation 1.0 3.0 ) 100000 )
switch route=ferry switch allow_ferries 2.34 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.
switch highway=pedestrian switch ismuddy 1.3 1.0
switch highway=bridleway switch ismuddy 2.5 1.2
switch highway=cycleway switch ismuddy 1.4
switch iswet 1.0 1.2
switch highway=residential|living_street
switch ismuddy 1.5
switch iswet 1.0 1.1
switch highway=service switch ismuddy 1.5
switch iswet 1.1 1.3
switch highway=track|road|path|footway
switch tracktype=grade1 switch ismuddy 1.1
switch iswet 1.0 1.21
switch tracktype=grade2 switch ismuddy 1.25
switch iswet 1.11 1.12
switch tracktype=grade3 switch ismuddy 1.4
switch iswet 1.21 1.07
switch tracktype=grade4 switch ismuddy 1.7
switch iswet 1.31 1.05
switch tracktype=grade5 switch ismuddy 2.0
switch iswet 1.5 1.01
switch ismuddy 2.01
switch iswet 1.51 1.12
switch highway=motorway|motorway_link 100000
switch highway=proposed|abandoned switch ismuddy 3 1.5
switch highway=construction switch ismuddy 10 2.5
switch highway=trunk|trunk_link|primary|primary_link switch iswet switch issidewalk 2.5 5
switch issidewalk 5 10
switch highway=secondary|secondary_link switch iswet switch issidewalk 2.0 2.5
switch issidewalk 2.5 4.0
switch highway=tertiary|tertiary_link|unclassified switch ismuddy 2.0 switch iswet switch issidewalk 1.4 1.7
switch issidewalk 1.7 2.0
add cost_of_unknown ( switch ismuddy 0.5 0.0 )
---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
# changelog:
# *** Based on Trekking profile, added flag driven customizations
# 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

21
misc/profiles2/rail.brf Normal file
View file

@ -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 railway=rail 1
100000
---context:node # following code refers to node tags
assign initialcost 0

21
misc/profiles2/river.brf Normal file
View file

@ -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 waterway=lock_gate 1
100000
---context:node # following code refers to node tags
assign initialcost 0

View file

@ -5,34 +5,47 @@
---context:global # following code refers to global config ---context:global # following code refers to global config
# Bike profile
assign validForBikes = true
# Use the following switches to change behaviour # Use the following switches to change behaviour
# (1=yes, 0=no): 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 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 considerTurnRestrictions = false # %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
assign consider_elevation = true # set to false to ignore elevation in routing # Change elevation parameters
assign allow_steps = true # set to false to disallow steps assign consider_elevation = true # %consider_elevation% | Set to false to ignore elevation in routing | boolean
assign allow_ferries = true # set to false to disallow ferries assign downhillcost = 60 # %downhillcost% | Cost for going downhill | number
assign ignore_cycleroutes = false # set to true for better elevation results assign downhillcutoff = 1.5 # %downhillcutoff% | Gradients below this value in percents are not counted. | number
assign stick_to_cycleroutes = false # set to true to just follow cycleroutes assign uphillcost = 0 # %uphillcost% | Cost for going uphill | number
assign avoid_unsafe = false # set to true to avoid standard highways assign uphillcutoff = 1.5 # %uphillcutoff% | Gradients below this value in percents are not counted. | number
assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
assign validForBikes = true assign downhillcost = if consider_elevation then downhillcost else 0
assign uphillcost = if consider_elevation then uphillcost else 0
# the elevation parameters # 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
assign downhillcost = if consider_elevation then 60 else 0 # Turn instructions settings
assign downhillcutoff = 1.5 assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style]
assign uphillcost = 0 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 uphillcutoff = 1.5 assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean
# classifier constants
assign classifier_none = 1
assign classifier_ferry = 2
---context:way # following code refers to way-tags ---context:way # following code refers to way-tags
# classifier constants
assign classifier_none = 1
assign classifier_ferry = 2
# #
# pre-calculate some logical expressions # pre-calculate some logical expressions
# #
@ -288,6 +301,7 @@ assign classifiermask add isbadoneway
add multiply islinktype 8 add multiply islinktype 8
multiply isgoodforcars 16 multiply isgoodforcars 16
---context:node # following code refers to node tags ---context:node # following code refers to node tags
assign defaultaccess = assign defaultaccess =

View file

@ -0,0 +1,18 @@
#!/usr/bin/sh
cd "$(dirname "$0")"
cd ../profiles2
# Car variants
sed -e "s/^assign[[:space:]]\+vmax.*\(#.*\)/assign vmax = 160 \1/" car-vario.brf > car-fast.brf
sed -e "s/^assign[[:space:]]\+vmax.*\(#.*\)/assign vmax = 90 \1/" car-vario.brf > car-eco.brf
# Fastbike variants
sed -e "s/^assign[[:space:]]\+allow_motorways.*\(#.*\)/assign allow_motorways = true \1/" fastbike.brf > fastbike-asia-pacific.brf
sed -e "s/^assign[[:space:]]\+consider_traffic.*\(#.*\)/assign consider_traffic = true \1/" fastbike.brf > fastbike-lowtraffic.brf
# Trekking variants
sed -e "s/^assign[[:space:]]\+ignore_cycleroutes.*\(#.*\)/assign ignore_cycleroutes = true \1/" trekking.brf > trekking-ignore-cr.brf
sed -e "s/^assign[[:space:]]\+allow_ferries.*\(#.*\)/assign allow_ferries = false \1/" trekking.brf > trekking-noferries.brf
sed -e "s/^assign[[:space:]]\+allow_steps.*\(#.*\)/assign allow_steps = false \1/" trekking.brf > trekking-nosteps.brf
sed -e "s/^assign[[:space:]]\+consider_elevation.*\(#.*\)/assign consider_elevation = false \1/" trekking.brf > trekking-steep.brf
sed -e "s/^assign[[:space:]]\+avoid_unsafe.*\(#.*\)/assign avoid_unsafe = true \1/" trekking.brf > safety.brf