for race bike
(when ever possible, no gravel or else and low traffic)
==> cost for unpaved enhanced
==> cost for trunk, primary, secondary enhanced
(see “assign costfactor”)
Structure is similar to fastbike, see this for documentation.
—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 surface=unpaved|compacted|fine_gravel|gravel|dirt|earth|ground|sand
assign isfine_gravel surface=fine_gravel|cobblestone
assign turncost = if junction=roundabout then 0
else 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
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 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 10000
switch or highway=trunk highway=trunk_link 30
switch or highway=primary highway=primary_link
switch cycleway=lane|shared_lane|shared 3.9 5
switch or highway=secondary highway=secondary_link
switch cycleway=lane|shared_lane|shared 1.4 3.5
switch or highway=tertiary highway=tertiary_link
switch cycleway=lane|shared_lane|shared 1.1 1.4
switch highway=unclassified
switch ispaved 1.5
switch isfine_gravel 2.5
switch isunpaved 15 3
switch highway=pedestrian 10
switch highway=steps 1000
switch route=ferry 5.67
switch highway=bridleway 5
switch highway=cycleway 1
switch highway=residential|living_street 1.2
switch highway=service
switch ispaved 1.2
switch isfine_gravel 2.2
switch isunpaved 10.2
switch tracktype=grade1 1.4 2
switch highway=track|road|path|footway
switch bicycle=designated 1
switch tracktype=grade1
switch isunpaved 15
switch isfine_gravel 3 1.5
switch tracktype=grade2 10
switch tracktype=grade3 30.0
switch tracktype=grade4 50.0
switch tracktype=grade5 300.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 ( 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 ) 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 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 bikeaccess
0
switch footaccess
300
1000000