Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions features/bicycle/cycleway.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,38 @@ 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 |
| 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 |
Expand Down Expand Up @@ -97,3 +113,21 @@ 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 | no | | |
| 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 | 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 |
| footway | track | 15 km/h | 15 km/h |
10 changes: 8 additions & 2 deletions profiles/bicycle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down