prefer ways on route=bicycle
This commit is contained in:
parent
45e4a6a1f6
commit
8ee25665da
@ -32,6 +32,7 @@ function setup()
|
||||
turn_penalty = 6,
|
||||
turn_bias = 1.4,
|
||||
use_public_transport = true,
|
||||
route_preference = 1.1,
|
||||
|
||||
allowed_start_modes = Set {
|
||||
mode.cycling,
|
||||
@ -324,6 +325,7 @@ function handle_bicycle_tags(profile,way,result,data)
|
||||
end
|
||||
|
||||
safety_handler(profile,way,result,data)
|
||||
bicycle_relation_handler(profile,way,result,data,relations)
|
||||
end
|
||||
|
||||
|
||||
@ -464,6 +466,16 @@ function cycleway_handler(profile,way,result,data)
|
||||
end
|
||||
end
|
||||
|
||||
function bicycle_relation_handler(profile,way,result,data,relations)
|
||||
-- prefer ways on route=bicycle by factor of profile.route_preference
|
||||
if result.forward_rate and Relations.filter_relations(relations, way, "route", "bicycle", "route", "forward") == "bicycle" then
|
||||
result.forward_rate = result.forward_rate * profile.route_preference
|
||||
end
|
||||
if result.backward_rate and Relations.filter_relations(relations, way, "route", "bicycle", "route", "backward") == "bicycle" then
|
||||
result.backward_rate = result.backward_rate * profile.route_preference
|
||||
end
|
||||
end
|
||||
|
||||
function bike_push_handler(profile,way,result,data)
|
||||
-- pushing bikes - if no other mode found
|
||||
if result.forward_mode == mode.inaccessible or result.backward_mode == mode.inaccessible or
|
||||
|
||||
Loading…
Reference in New Issue
Block a user