From 5a2da798c8003cdef56ad16622eabb6580272944 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Mon, 27 Mar 2017 14:31:08 +0200 Subject: [PATCH] fixes speed on cycleway+oneway #3853 --- features/bicycle/cycleway.feature | 16 ++++++++++++++++ profiles/bicycle.lua | 20 ++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/features/bicycle/cycleway.feature b/features/bicycle/cycleway.feature index 643fdcea2..d495f2e46 100644 --- a/features/bicycle/cycleway.feature +++ b/features/bicycle/cycleway.feature @@ -79,3 +79,19 @@ Feature: Bike - Cycle tracks/lanes | residential | lane | yes | x | x | | footway | lane | yes | x | x | | cycleway | lane | yes | x | x | + + Scenario: Bike - Cycleway on oneways, modes + Then routability should be + | highway | cycleway | oneway | forw | backw | + | motorway | track | yes | cycling | | + | residential | track | yes | cycling | pushing bike | + | cycleway | track | yes | cycling | pushing bike | + | footway | track | yes | pushing bike | pushing bike | + + Scenario: Bike - Cycleway on oneways, speeds + Then routability should be + | highway | cycleway | oneway | forw | backw | + | motorway | track | yes | 15 km/h | | + | residential | track | yes | 15 km/h | 6 km/h | + | cycleway | track | yes | 15 km/h | 6 km/h | + | footway | track | yes | 6 km/h +-1 | 6 km/h +-1 | diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index dd4641b52..6e2b27dfb 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -444,17 +444,29 @@ function way_function (way, result) end -- cycleways + local has_cycleway_left, has_cycleway_right if cycleway and profile.cycleway_tags[cycleway] then - result.forward_speed = profile.bicycle_speeds["cycleway"] - result.backward_speed = profile.bicycle_speeds["cycleway"] + has_cycleway_left = true + has_cycleway_right = true elseif cycleway_left and profile.cycleway_tags[cycleway_left] then - result.forward_speed = profile.bicycle_speeds["cycleway"] - result.backward_speed = profile.bicycle_speeds["cycleway"] + has_cycleway_left = true + has_cycleway_right = true elseif cycleway_right and profile.cycleway_tags[cycleway_right] then + has_cycleway_left = true + has_cycleway_right = true + end + if has_cycleway_right and + (result.forward_mode == mode.inaccessible or + result.forward_mode == mode.cycling) then result.forward_speed = profile.bicycle_speeds["cycleway"] + end + if has_cycleway_left and + (result.backward_mode == mode.inaccessible or + result.backward_mode == mode.cycling) then result.backward_speed = profile.bicycle_speeds["cycleway"] end + -- dismount if bicycle == "dismount" then result.forward_mode = mode.pushing_bike