diff --git a/features/bicycle/area.feature b/features/bicycle/area.feature index ab954dd86..267e57539 100644 --- a/features/bicycle/area.feature +++ b/features/bicycle/area.feature @@ -3,7 +3,8 @@ Feature: Bike - Squares and other areas Background: Given the speedprofile "bicycle" - + + @square Scenario: Bike - Route along edge of a squares Given the node map | x | | @@ -25,7 +26,8 @@ Feature: Bike - Squares and other areas | d | c | abcda | | d | a | abcda | | a | d | abcda | - + + @building Scenario: Bike - Don't route on buildings Given the node map | x | | @@ -47,3 +49,55 @@ Feature: Bike - Squares and other areas | d | c | | | d | a | | | a | d | | + + @parking + Scenario: Bike - parking areas + Given the node map + | e | | | f | + | x | a | b | y | + | | d | c | | + + And the ways + | nodes | highway | amenity | + | xa | primary | | + | by | primary | | + | xefy | primary | | + | abcda | (nil) | parking | + + When I route I should get + | from | to | route | + | x | y | xa,abcda,by | + | y | x | by,abcda,xa | + | a | b | abcda | + | a | d | abcda | + | b | c | abcda | + | c | b | abcda | + | c | d | abcda | + | d | c | abcda | + | d | a | abcda | + | a | d | abcda | + + @train @platform + Scenario: Bike - railway platforms + Given the node map + | x | a | b | y | + | | d | c | | + + And the ways + | nodes | highway | railway | + | xa | primary | | + | by | primary | | + | abcda | (nil) | platform | + + When I route I should get + | from | to | route | + | x | y | xa,abcda,by | + | y | x | by,abcda,xa | + | a | b | abcda | + | a | d | abcda | + | b | c | abcda | + | c | b | abcda | + | c | d | abcda | + | d | c | abcda | + | d | a | abcda | + | a | d | abcda | diff --git a/features/bicycle/train.feature b/features/bicycle/train.feature index cb7a76171..dd67e08db 100644 --- a/features/bicycle/train.feature +++ b/features/bicycle/train.feature @@ -1,4 +1,4 @@ -@routing @bicycle @train @todo +@routing @bicycle @train Feature: Bike - Handle ferry routes Bringing bikes on trains and subways diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index b082dc747..8f24d791e 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -34,7 +34,7 @@ pedestrian_speeds = { ["footway"] = 5, ["pedestrian"] = 5, ["pier"] = 5, - ["steps"] = 2, + ["steps"] = 2 } railway_speeds = { @@ -46,6 +46,15 @@ railway_speeds = { ["tram"] = 10 } +platform_speeds = { + ["platform"] = 5 +} + +amenity_speeds = { + ["parking"] = 10, + ["parking_entrance"] = 10 +} + route_speeds = { ["ferry"] = 5 } @@ -123,10 +132,14 @@ function way_function (way, numberOfNodesInWay) local duration = way.tags:Find("duration") local service = way.tags:Find("service") local area = way.tags:Find("area") + local amenity = way.tags:Find("amenity") local access = find_access_tag(way) -- only route on things with highway tag set (not buildings, boundaries, etc) - if (not highway or highway == '') and (not route or route == '') and (not railway or railway=='') then + if (not highway or highway == '') and + (not route or route == '') and + (not railway or railway=='') and + (not amenity or amenity=='') then return 0 end @@ -154,8 +167,11 @@ function way_function (way, numberOfNodesInWay) else way.speed = route_speeds[route] end + elseif railway and platform_speeds[railway] then + -- railway platforms + way.speed = platform_speeds[railway] elseif railway and railway_speeds[railway] then - -- trains and subways + -- railways if access and access_tag_whitelist[access] then way.speed = railway_speeds[railway] way.direction = Way.bidirectional @@ -167,6 +183,9 @@ function way_function (way, numberOfNodesInWay) else way.speed = pedestrian_speeds[highway] -- pushing bikes end + elseif amenity and amenity_speeds[amenity] then + -- parking areas + way.speed = amenity_speeds[amenity] else -- regular ways if main_speeds[highway] then