247 lines
7.5 KiB
Text
247 lines
7.5 KiB
Text
# *** The trekking profile is for slow travel
|
|
# *** and avoiding car traffic, but still with
|
|
# *** a focus on approaching your destination
|
|
# *** efficiently.
|
|
|
|
---context:global # following code refers to global config
|
|
|
|
# Use the following switches to change behaviour
|
|
# (1=yes, 0=no):
|
|
|
|
assign consider_elevation = true # set to false to ignore elevation in routing
|
|
assign allow_steps = true # set to false to disallow steps
|
|
assign allow_ferries = true # set to false to disallow ferries
|
|
assign ignore_cycleroutes = false # set to true for better elevation results
|
|
assign stick_to_cycleroutes = false # set to true to just follow cycleroutes
|
|
assign avoid_unsafe = false # set to true to avoid standard highways
|
|
|
|
assign validForBikes = true
|
|
|
|
# the elevation parameters
|
|
|
|
assign downhillcost = if consider_elevation then 60 else 0
|
|
assign downhillcutoff = 1.5
|
|
assign uphillcost = 0
|
|
assign uphillcutoff = 1.5
|
|
|
|
|
|
# classifier constants
|
|
|
|
assign classifier_none = 1
|
|
assign classifier_ferry = 2
|
|
|
|
---context:way # following code refers to way-tags
|
|
|
|
#
|
|
# pre-calculate some logical expressions
|
|
#
|
|
|
|
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 nodeaccessgranted =
|
|
if any_cycleroute then true
|
|
else lcn=yes
|
|
|
|
assign is_ldcr =
|
|
if ignore_cycleroutes then false
|
|
else any_cycleroute
|
|
|
|
assign isbike = or bicycle=yes or or bicycle=permissive bicycle=designated lcn=yes
|
|
assign ispaved = surface=paved|asphalt|concrete|paving_stones
|
|
assign isunpaved = not or surface= or ispaved surface=fine_gravel|cobblestone
|
|
assign probablyGood = or ispaved and isbike not isunpaved
|
|
|
|
|
|
#
|
|
# this is the cost (in Meter) for a 90-degree turn
|
|
# The actual cost is calculated as turncost*cos(angle)
|
|
# (Suppressing turncost while following longdistance-cycleways
|
|
# makes them a little bit more magnetic)
|
|
#
|
|
assign turncost = if is_ldcr then 0 else 90
|
|
|
|
|
|
#
|
|
# 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
|
|
|
|
#
|
|
# implicit access here just from the motorroad tag
|
|
# (implicit access rules from highway tag handled elsewhere)
|
|
#
|
|
assign defaultaccess =
|
|
if access= then not motorroad=yes
|
|
else if access=private|no then false
|
|
else true
|
|
|
|
#
|
|
# calculate logical bike access
|
|
#
|
|
assign bikeaccess =
|
|
if any_cycleroute then true
|
|
else if bicycle= then
|
|
(
|
|
if vehicle= then defaultaccess
|
|
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 defaultaccess
|
|
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 4
|
|
else 100000
|
|
|
|
#
|
|
# 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 - you are allowed
|
|
# to push your bike)
|
|
#
|
|
assign oneway =
|
|
if oneway= then junction=roundabout else oneway=yes|true|1
|
|
|
|
assign onewaypenalty =
|
|
if ( if reversedirection=yes then oneway else oneway=-1 ) 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
|
|
|
|
|
|
#
|
|
# calculate the cost-factor, which is the factor
|
|
# by which the distance of a way-segment is multiplied
|
|
# to calculate the cost of that segment. The costfactor
|
|
# must be >=1 and it's supposed to be close to 1 for
|
|
# the type of way the routing profile is searching for
|
|
#
|
|
assign costfactor =
|
|
|
|
add ( max onewaypenalty accesspenalty )
|
|
|
|
if ( and highway= not route=ferry ) then 100000
|
|
|
|
#
|
|
# steps and ferries are special. Note this is handled
|
|
# before the cycleroute-switch, to be able
|
|
# to really exlude them be setting cost to infinity
|
|
#
|
|
else if ( highway=steps ) then ( if allow_steps then 40 else 100000 )
|
|
else if ( route=ferry ) then ( if allow_ferries then 5.67 else 100000 )
|
|
|
|
#
|
|
# handle long-distance cycle-routes.
|
|
#
|
|
else if ( is_ldcr ) then 1 # always treated as perfect (=1)
|
|
else
|
|
add ( if stick_to_cycleroutes then 0.5 else 0.05 ) # everything else somewhat up
|
|
|
|
#
|
|
# some other highway types
|
|
#
|
|
if ( highway=pedestrian ) then 3
|
|
else if ( highway=bridleway ) then 5
|
|
else if ( highway=cycleway ) then 1
|
|
else if ( highway=residential|living_street ) then ( if isunpaved then 1.5 else 1.1 )
|
|
else if ( highway=service ) then ( if isunpaved then 1.6 else 1.3 )
|
|
|
|
#
|
|
# tracks and track-like ways are rated mainly be tracktype/grade
|
|
# But note that if no tracktype is given (mainly for road/path/footway)
|
|
# it can be o.k. if there's any other hint for quality
|
|
#
|
|
else if ( highway=track|road|path|footway ) then
|
|
(
|
|
if ( tracktype=grade1 ) then ( if probablyGood then 1.0 else 1.3 )
|
|
else if ( tracktype=grade2 ) then ( if probablyGood then 1.1 else 2.0 )
|
|
else if ( tracktype=grade3 ) then ( if probablyGood then 1.5 else 3.0 )
|
|
else if ( tracktype=grade4 ) then ( if probablyGood then 2.0 else 5.0 )
|
|
else if ( tracktype=grade5 ) then ( if probablyGood then 3.0 else 5.0 )
|
|
else ( if probablyGood then 1.0 else 5.0 )
|
|
)
|
|
|
|
#
|
|
# When avoiding unsafe ways, avoid highways without a bike hint
|
|
#
|
|
else add ( if ( and avoid_unsafe not isbike ) then 2 else 0 )
|
|
|
|
#
|
|
# exclude motorways and proposed roads
|
|
#
|
|
if ( highway=motorway|motorway_link ) then 100000
|
|
else if ( highway=proposed|abandoned ) then 100000
|
|
|
|
#
|
|
# actuals roads are o.k. if we have a bike hint
|
|
#
|
|
else if ( highway=trunk|trunk_link ) then ( if isbike then 1.5 else 10 )
|
|
else if ( highway=primary|primary_link ) then ( if isbike then 1.2 else 3 )
|
|
else if ( highway=secondary|secondary_link ) then ( if isbike then 1.1 else 1.6 )
|
|
else if ( highway=tertiary|tertiary_link ) then ( if isbike then 1.0 else 1.4 )
|
|
else if ( highway=unclassified ) then ( if isbike then 1.0 else 1.3 )
|
|
|
|
#
|
|
# default for any other highway type not handled above
|
|
#
|
|
else 2.0
|
|
|
|
|
|
---context:node # following code refers to node tags
|
|
|
|
assign defaultaccess =
|
|
if ( access= ) then true # add default barrier restrictions here!
|
|
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 =
|
|
if bikeaccess then 0
|
|
else ( if footaccess then 100 else 1000000 )
|