prefer ways on route=bicycle

This commit is contained in:
MichalPP 2018-05-19 10:50:05 +02:00 committed by GitHub
parent 076c8b6dab
commit 068e240739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,
@ -314,6 +315,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
@ -454,6 +456,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