From ab5c99c36dc2eea699d217d8f8576643b597b48a Mon Sep 17 00:00:00 2001 From: James Addison Date: Mon, 9 May 2022 14:38:40 +0100 Subject: [PATCH 1/4] Add test coverage for cycleway=no cases --- features/bicycle/cycleway.feature | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/features/bicycle/cycleway.feature b/features/bicycle/cycleway.feature index c04d7aabd16..267338b6480 100644 --- a/features/bicycle/cycleway.feature +++ b/features/bicycle/cycleway.feature @@ -9,16 +9,22 @@ Feature: Bike - Cycle tracks/lanes Then routability should be | highway | cycleway | forw | backw | | motorway | | | | + | motorway | no | | | | motorway | track | x | | | motorway | lane | x | | | motorway | shared | x | | | motorway | share_busway | x | | | motorway | sharrow | x | | + | some_tag | | | | + | some_tag | no | | | | some_tag | track | x | x | | some_tag | lane | x | x | | some_tag | shared | x | x | | some_tag | share_busway | x | x | | some_tag | sharrow | x | x | + # residential ways may not have cycleways present but they should be routable + | residential | | x | x | + | residential | no | x | x | | residential | track | x | x | | residential | lane | x | x | | residential | shared | x | x | From ce0092f6838db25a5d933afd0e5c8544f42d2751 Mon Sep 17 00:00:00 2001 From: James Addison Date: Mon, 9 May 2022 16:53:11 +0100 Subject: [PATCH 2/4] Add test coverage for bidirectional cycleways as defined by way key 'cycleway:both' --- features/bicycle/cycleway.feature | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/features/bicycle/cycleway.feature b/features/bicycle/cycleway.feature index 267338b6480..9d96bb40085 100644 --- a/features/bicycle/cycleway.feature +++ b/features/bicycle/cycleway.feature @@ -31,6 +31,16 @@ Feature: Bike - Cycle tracks/lanes | residential | share_busway | x | x | | residential | sharrow | x | x | + Scenario: Bike - Bidirectional cycleways + Then routability should be + | highway | cycleway:both | forw | backw | + | primary | | x | x | + | primary | track | x | x | + | primary | opposite | x | x | + | motorway | | | | + | motorway | track | x | x | + | motorway | opposite | x | x | + Scenario: Bike - Left/right side cycleways on implied bidirectionals Then routability should be | highway | cycleway | cycleway:left | cycleway:right | forw | backw | @@ -103,3 +113,19 @@ Feature: Bike - Cycle tracks/lanes | residential | track | yes | 15 km/h | 4 km/h +-1 | | cycleway | track | yes | 15 km/h | 4 km/h +-1 | | footway | track | yes | 15 km/h | 4 km/h +-1 | + + Scenario: Bike - Cycleway on twoways, modes + Then routability should be + | highway | cycleway:both | forw | backw | + | motorway | track | cycling | cycling | + | residential | track | cycling | cycling | + | cycleway | track | cycling | cycling | + | footway | track | cycling | cycling | + + Scenario: Bike - Cycleway on twoways, speeds + Then routability should be + | highway | cycleway:both | forw | backw | + | motorway | track | 15 km/h | 15 km/h | + | residential | track | 15 km/h | 15 km/h | + | cycleway | track | 15 km/h | 15 km/h | + | footway | track | 15 km/h | 15 km/h | From f541885e6940a2d0f219f70fdfaa9aba1ca451c1 Mon Sep 17 00:00:00 2001 From: James Addison Date: Mon, 9 May 2022 16:58:16 +0100 Subject: [PATCH 3/4] Permit 'cycleway:both' way key to populate both left-and-right cycleway definitions --- profiles/bicycle.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 223954f0219..32714fbb761 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -276,8 +276,8 @@ function handle_bicycle_tags(profile,way,result,data) data.oneway = way:get_value_by_key("oneway") data.oneway_bicycle = way:get_value_by_key("oneway:bicycle") data.cycleway = way:get_value_by_key("cycleway") - data.cycleway_left = way:get_value_by_key("cycleway:left") - data.cycleway_right = way:get_value_by_key("cycleway:right") + data.cycleway_left = way:get_value_by_key("cycleway:left") or way:get_value_by_key("cycleway:both") + data.cycleway_right = way:get_value_by_key("cycleway:right") or way:get_value_by_key("cycleway:both") data.duration = way:get_value_by_key("duration") data.service = way:get_value_by_key("service") data.foot = way:get_value_by_key("foot") @@ -370,6 +370,12 @@ function speed_handler(profile,way,result,data) end function oneway_handler(profile,way,result,data) + -- explicit twoway + local cycleway_both = way:get_value_by_key("cycleway:both") + if cycleway_both and profile.cycleway_tags[cycleway_both] then + return + end + -- oneway data.implied_oneway = data.junction == "roundabout" or data.junction == "circular" or data.highway == "motorway" data.reverse = false From d9aa54997802c8b0af002abddecea9b16feea6e4 Mon Sep 17 00:00:00 2001 From: James Addison Date: Mon, 9 May 2022 16:59:48 +0100 Subject: [PATCH 4/4] Add test coverage for cycleway:both=no cases --- features/bicycle/cycleway.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/bicycle/cycleway.feature b/features/bicycle/cycleway.feature index 9d96bb40085..fbee59f1d09 100644 --- a/features/bicycle/cycleway.feature +++ b/features/bicycle/cycleway.feature @@ -117,6 +117,7 @@ Feature: Bike - Cycle tracks/lanes Scenario: Bike - Cycleway on twoways, modes Then routability should be | highway | cycleway:both | forw | backw | + | motorway | no | | | | motorway | track | cycling | cycling | | residential | track | cycling | cycling | | cycleway | track | cycling | cycling | @@ -125,6 +126,7 @@ Feature: Bike - Cycle tracks/lanes Scenario: Bike - Cycleway on twoways, speeds Then routability should be | highway | cycleway:both | forw | backw | + | motorway | no | | | | motorway | track | 15 km/h | 15 km/h | | residential | track | 15 km/h | 15 km/h | | cycleway | track | 15 km/h | 15 km/h |