From dd5d520b5383191f172ba808ce1b503ca8d0146a Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Sun, 3 Feb 2013 13:08:11 +0100 Subject: [PATCH] update profile and tests for pushing of bikes --- features/bicycle/access.feature | 167 ++++++++++++++------------ features/bicycle/access_node.feature | 64 ++++++++++ features/bicycle/cycleway.feature | 20 +-- features/bicycle/oneway.feature | 143 +++++++++++----------- features/bicycle/pushing.feature | 72 +++++++++++ features/bicycle/restrictions.feature | 120 +++++++++--------- features/bicycle/way.feature | 60 ++++----- features/car/permissive.feature | 0 profiles/bicycle.lua | 152 +++++++++++++---------- 9 files changed, 494 insertions(+), 304 deletions(-) create mode 100644 features/bicycle/access_node.feature create mode 100644 features/bicycle/pushing.feature create mode 100644 features/car/permissive.feature diff --git a/features/bicycle/access.feature b/features/bicycle/access.feature index 149a2743c..cb1fc0d0b 100644 --- a/features/bicycle/access.feature +++ b/features/bicycle/access.feature @@ -1,5 +1,5 @@ @routing @bicycle @access -Feature: Bike - Restricted access +Feature: Bike - Access tags on ways Reference: http://wiki.openstreetmap.org/wiki/Key:access Background: @@ -7,37 +7,95 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access Scenario: Bike - Access tag hierachy on ways Then routability should be - | access | vehicle | bicycle | bothw | - | | | | x | - | yes | | | x | - | no | | | | - | | yes | | x | - | | no | | | - | no | yes | | x | - | yes | no | | | - | | | yes | x | - | | | no | | - | no | | yes | x | - | yes | | no | | - | | no | yes | x | - | | yes | no | | + | highway | access | vehicle | bicycle | bothw | + | | | | | x | + | | yes | | | x | + | | no | | | | + | | | yes | | x | + | | | no | | | + | | no | yes | | x | + | | yes | no | | | + | | | | yes | x | + | | | | no | | + | | no | | yes | x | + | | yes | | no | | + | | | no | yes | x | + | | | yes | no | | + | runway | | | | | + | runway | yes | | | x | + | runway | no | | | | + | runway | | yes | | x | + | runway | | no | | | + | runway | no | yes | | x | + | runway | yes | no | | | + | runway | | | yes | x | + | runway | | | no | | + | runway | no | | yes | x | + | runway | yes | | no | | + | runway | | no | yes | x | + | runway | | yes | no | | - Scenario: Bike - Access tag hierachy on nodes - Then routability should be - | node/access | node/vehicle | node/bicycle | bothw | - | | | | x | - | yes | | | x | - | no | | | | - | | yes | | x | - | | no | | | - | no | yes | | x | - | yes | no | | | - | | | yes | x | - | | | no | | - | no | | yes | x | - | yes | | no | | - | | no | yes | x | - | | yes | no | | + @todo + Scenario: Bike - Access tag in forward direction + Then routability should be + | highway | access:forward | vehicle:forward | bicycle:forward | forw | backw | + | | | | | x | | + | | yes | | | x | | + | | no | | | | | + | | | yes | | x | | + | | | no | | | | + | | no | yes | | x | | + | | yes | no | | | | + | | | | yes | x | | + | | | | no | | | + | | no | | yes | x | | + | | yes | | no | | | + | | | no | yes | x | | + | | | yes | no | | | + | runway | | | | x | | + | runway | yes | | | x | | + | runway | no | | | | | + | runway | | yes | | x | | + | runway | | no | | | | + | runway | no | yes | | x | | + | runway | yes | no | | | | + | runway | | | yes | x | | + | runway | | | no | | | + | runway | no | | yes | x | | + | runway | yes | | no | | | + | runway | | no | yes | x | | + | runway | | yes | no | | | + + @todo + Scenario: Bike - Access tag in backward direction + Then routability should be + | highway | access:forward | vehicle:forward | bicycle:forward | forw | backw | + | | | | | | x | + | | yes | | | | x | + | | no | | | | | + | | | yes | | | x | + | | | no | | | | + | | no | yes | | | x | + | | yes | no | | | | + | | | | yes | | x | + | | | | no | | | + | | no | | yes | | x | + | | yes | | no | | | + | | | no | yes | | x | + | | | yes | no | | | + | runway | | | | | x | + | runway | yes | | | | x | + | runway | no | | | | | + | runway | | yes | | | x | + | runway | | no | | | | + | runway | no | yes | | | x | + | runway | yes | no | | | | + | runway | | | yes | | x | + | runway | | | no | | | + | runway | no | | yes | | x | + | runway | yes | | no | | | + | runway | | no | yes | | x | + | runway | | yes | no | | | Scenario: Bike - Overwriting implied acccess on ways Then routability should be @@ -51,18 +109,6 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access | runway | | yes | | x | | runway | | | yes | x | - Scenario: Bike - Overwriting implied acccess on nodes - Then routability should be - | highway | node/access | node/vehicle | node/bicycle | bothw | - | cycleway | | | | x | - | runway | | | | | - | cycleway | no | | | | - | cycleway | | no | | | - | cycleway | | | no | | - | runway | yes | | | | - | runway | | yes | | | - | runway | | | yes | | - Scenario: Bike - Access tags on ways Then routability should be | access | vehicle | bicycle | bothw | @@ -92,35 +138,6 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access | | | agricultural | | | | | forestery | | - Scenario: Bike - Access tags on nodes - Then routability should be - | node/access | node/vehicle | node/bicycle | bothw | - | | | | x | - | yes | | | x | - | permissive | | | x | - | designated | | | x | - | some_tag | | | x | - | no | | | | - | private | | | | - | agricultural | | | | - | forestery | | | | - | | yes | | x | - | | permissive | | x | - | | designated | | x | - | | some_tag | | x | - | | no | | | - | | private | | | - | | agricultural | | | - | | forestery | | | - | | | yes | x | - | | | permissive | x | - | | | designated | x | - | | | some_tag | x | - | | | no | | - | | | private | | - | | | agricultural | | - | | | forestery | | - Scenario: Bike - Access tags on both node and way Then routability should be | access | node/access | bothw | @@ -147,10 +164,10 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access Scenario: Bike - Ignore access tags for other modes Then routability should be - | highway | foot | motor_vehicle | moped | bothw | - | runway | yes | | | | + | highway | boat | motor_vehicle | moped | bothw | + | river | yes | | | | | cycleway | no | | | x | | runway | | yes | | | | cycleway | | no | | x | | runway | | | yes | | - | cycleway | | | no | x | \ No newline at end of file + | cycleway | | | no | x | diff --git a/features/bicycle/access_node.feature b/features/bicycle/access_node.feature new file mode 100644 index 000000000..eba808d52 --- /dev/null +++ b/features/bicycle/access_node.feature @@ -0,0 +1,64 @@ +@routing @bicycle @access +Feature: Bike - Access tags on nodes +Reference: http://wiki.openstreetmap.org/wiki/Key:access + + Background: + Given the profile "bicycle" + + Scenario: Bike - Access tag hierachy on nodes + Then routability should be + | node/access | node/vehicle | node/bicycle | bothw | + | | | | x | + | yes | | | x | + | no | | | | + | | yes | | x | + | | no | | | + | no | yes | | x | + | yes | no | | | + | | | yes | x | + | | | no | | + | no | | yes | x | + | yes | | no | | + | | no | yes | x | + | | yes | no | | + + Scenario: Bike - Overwriting implied acccess on nodes + Then routability should be + | highway | node/access | node/vehicle | node/bicycle | bothw | + | cycleway | | | | x | + | runway | | | | | + | cycleway | no | | | | + | cycleway | | no | | | + | cycleway | | | no | | + | runway | yes | | | | + | runway | | yes | | | + | runway | | | yes | | + + Scenario: Bike - Access tags on nodes + Then routability should be + | node/access | node/vehicle | node/bicycle | bothw | + | | | | x | + | yes | | | x | + | permissive | | | x | + | designated | | | x | + | some_tag | | | x | + | no | | | | + | private | | | | + | agricultural | | | | + | forestery | | | | + | | yes | | x | + | | permissive | | x | + | | designated | | x | + | | some_tag | | x | + | | no | | | + | | private | | | + | | agricultural | | | + | | forestery | | | + | | | yes | x | + | | | permissive | x | + | | | designated | x | + | | | some_tag | x | + | | | no | | + | | | private | | + | | | agricultural | | + | | | forestery | | \ No newline at end of file diff --git a/features/bicycle/cycleway.feature b/features/bicycle/cycleway.feature index bf42563ff..f26029453 100644 --- a/features/bicycle/cycleway.feature +++ b/features/bicycle/cycleway.feature @@ -29,16 +29,16 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:cycleway Then routability should be | highway | cycleway | cycleway:left | cycleway:right | forw | backw | | primary | | | | x | x | - | pirmary | track | | | x | x | - | pirmary | opposite | | | x | x | - | pirmary | | track | | x | x | - | pirmary | | opposite | | x | x | - | pirmary | | | track | x | x | - | pirmary | | | opposite | x | x | - | pirmary | | track | track | x | x | - | pirmary | | opposite | opposite | x | x | - | pirmary | | track | opposite | x | x | - | pirmary | | opposite | track | x | x | + | primary | track | | | x | x | + | primary | opposite | | | x | x | + | primary | | track | | x | x | + | primary | | opposite | | x | x | + | primary | | | track | x | x | + | primary | | | opposite | x | x | + | primary | | track | track | x | x | + | primary | | opposite | opposite | x | x | + | primary | | track | opposite | x | x | + | primary | | opposite | track | x | x | Scenario: Bike - Left/right side cycleways on implied oneways Then routability should be diff --git a/features/bicycle/oneway.feature b/features/bicycle/oneway.feature index 4e6cb4f2d..6a9d3bf02 100644 --- a/features/bicycle/oneway.feature +++ b/features/bicycle/oneway.feature @@ -1,19 +1,20 @@ @routing @bicycle @oneway Feature: Bike - Oneway streets Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing +Usually we can push bikes against oneways, but we use foot=no to prevent this in these tests Background: Given the profile "bicycle" Scenario: Bike - Simple oneway Then routability should be - | highway | oneway | forw | backw | - | primary | yes | x | | + | highway | foot | oneway | forw | backw | + | primary | no | yes | x | | Scenario: Simple reverse oneway Then routability should be - | highway | oneway | forw | backw | - | primary | -1 | | x | + | highway | foot | oneway | forw | backw | + | primary | no | -1 | | x | Scenario: Bike - Around the Block Given the node map @@ -21,11 +22,11 @@ Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tag | d | c | And the ways - | nodes | oneway | - | ab | yes | - | bc | | - | cd | | - | da | | + | nodes | oneway | foot | + | ab | yes | no | + | bc | | no | + | cd | | no | + | da | | no | When I route I should get | from | to | route | @@ -34,80 +35,80 @@ Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tag Scenario: Bike - Handle various oneway tag values Then routability should be - | oneway | forw | backw | - | | x | x | - | nonsense | x | x | - | no | x | x | - | false | x | x | - | 0 | x | x | - | yes | x | | - | true | x | | - | 1 | x | | - | -1 | | x | + | foot | oneway | forw | backw | + | no | | x | x | + | no | nonsense | x | x | + | no | no | x | x | + | no | false | x | x | + | no | 0 | x | x | + | no | yes | x | | + | no | true | x | | + | no | 1 | x | | + | no | -1 | | x | Scenario: Bike - Implied oneways Then routability should be - | highway | bicycle | junction | forw | backw | - | | | | x | x | - | | | roundabout | x | | - | motorway | yes | | x | | - | motorway_link | yes | | x | | - | motorway | yes | roundabout | x | | - | motorway_link | yes | roundabout | x | | + | highway | foot | bicycle | junction | forw | backw | + | | no | | | x | x | + | | no | | roundabout | x | | + | motorway | no | yes | | x | | + | motorway_link | no | yes | | x | | + | motorway | no | yes | roundabout | x | | + | motorway_link | no | yes | roundabout | x | | Scenario: Bike - Overriding implied oneways Then routability should be - | highway | junction | oneway | forw | backw | - | primary | roundabout | no | x | x | - | primary | roundabout | yes | x | | - | motorway_link | | -1 | | | - | trunk_link | | -1 | | | - | primary | roundabout | -1 | | x | + | highway | foot | junction | oneway | forw | backw | + | primary | no | roundabout | no | x | x | + | primary | no | roundabout | yes | x | | + | motorway_link | no | | -1 | | | + | trunk_link | no | | -1 | | | + | primary | no | roundabout | -1 | | x | Scenario: Bike - Oneway:bicycle should override normal oneways tags Then routability should be - | oneway:bicycle | oneway | junction | forw | backw | - | yes | | | x | | - | yes | yes | | x | | - | yes | no | | x | | - | yes | -1 | | x | | - | yes | | roundabout | x | | - | no | | | x | x | - | no | yes | | x | x | - | no | no | | x | x | - | no | -1 | | x | x | - | no | | roundabout | x | x | - | -1 | | | | x | - | -1 | yes | | | x | - | -1 | no | | | x | - | -1 | -1 | | | x | - | -1 | | roundabout | | x | + | foot | oneway:bicycle | oneway | junction | forw | backw | + | no | yes | | | x | | + | no | yes | yes | | x | | + | no | yes | no | | x | | + | no | yes | -1 | | x | | + | no | yes | | roundabout | x | | + | no | no | | | x | x | + | no | no | yes | | x | x | + | no | no | no | | x | x | + | no | no | -1 | | x | x | + | no | no | | roundabout | x | x | + | no | -1 | | | | x | + | no | -1 | yes | | | x | + | no | -1 | no | | | x | + | no | -1 | -1 | | | x | + | no | -1 | | roundabout | | x | Scenario: Bike - Contra flow Then routability should be - | oneway | cycleway | forw | backw | - | yes | opposite | x | x | - | yes | opposite_track | x | x | - | yes | opposite_lane | x | x | - | -1 | opposite | x | x | - | -1 | opposite_track | x | x | - | -1 | opposite_lane | x | x | - | no | opposite | x | x | - | no | opposite_track | x | x | - | no | opposite_lane | x | x | + | foot | oneway | cycleway | forw | backw | + | no | yes | opposite | x | x | + | no | yes | opposite_track | x | x | + | no | yes | opposite_lane | x | x | + | no | -1 | opposite | x | x | + | no | -1 | opposite_track | x | x | + | no | -1 | opposite_lane | x | x | + | no | no | opposite | x | x | + | no | no | opposite_track | x | x | + | no | no | opposite_lane | x | x | Scenario: Bike - Should not be affected by car tags Then routability should be - | junction | oneway | oneway:car | forw | backw | - | | yes | yes | x | | - | | yes | no | x | | - | | yes | -1 | x | | - | | no | yes | x | x | - | | no | no | x | x | - | | no | -1 | x | x | - | | -1 | yes | | x | - | | -1 | no | | x | - | | -1 | -1 | | x | - | roundabout | | yes | x | | - | roundabout | | no | x | | - | roundabout | | -1 | x | | + | foot | junction | oneway | oneway:car | forw | backw | + | no | | yes | yes | x | | + | no | | yes | no | x | | + | no | | yes | -1 | x | | + | no | | no | yes | x | x | + | no | | no | no | x | x | + | no | | no | -1 | x | x | + | no | | -1 | yes | | x | + | no | | -1 | no | | x | + | no | | -1 | -1 | | x | + | no | roundabout | | yes | x | | + | no | roundabout | | no | x | | + | no | roundabout | | -1 | x | | diff --git a/features/bicycle/pushing.feature b/features/bicycle/pushing.feature new file mode 100644 index 000000000..37dff3d1f --- /dev/null +++ b/features/bicycle/pushing.feature @@ -0,0 +1,72 @@ +@routing @bicycle @pushing +Feature: Bike - Accessability of different way types + + Background: + Given the profile "bicycle" + Given the shortcuts + | key | value | + | bike | 40s ~20% | + | foot | 180s ~20% | + + Scenario: Bike - Pushing bikes on pedestrian-only ways + Then routability should be + | highway | oneway | forw | backw | + | (nil) | | | | + | cycleway | | bike | bike | + | primary | | bike | bike | + | pedestrian | | foot | foot | + | footway | | foot | foot | + | primary | yes | bike | foot | + + Scenario: Bike - Pushing bikes against normal oneways + Then routability should be + | highway | oneway | forw | backw | + | (nil) | | | | + | primary | yes | bike | foot | + | pedestrian | yes | foot | foot | + + Scenario: Bike - Pushing bikes against reverse oneways + Then routability should be + | highway | oneway | forw | backw | + | (nil) | | | | + | primary | -1 | foot | bike | + | pedestrian | -1 | foot | foot | + + @square + Scenario: Bike - Push bikes on pedestrian areas + Given the node map + | x | | + | a | b | + | d | c | + + And the ways + | nodes | area | highway | + | xa | | primary | + | abcda | yes | pedestrian | + + When I route I should get + | from | to | route | + | a | b | abcda | + | a | d | abcda | + | b | c | abcda | + | c | b | abcda | + | c | d | abcda | + | d | c | abcda | + | d | a | abcda | + | a | d | abcda | + + Scenario: Bike - Pushing bikes on ways with foot=yes + Then routability should be + | highway | foot | bothw | + | motorway | | | + | motorway | yes | foot | + | runway | | | + | runway | yes | foot | + + @todo + Scenario: Bike - Pushing bikes on ways with foot=yes in one direction + Then routability should be + | highway | foot:forward | foot:backward | forw | backw | + | motorway | | | | | + | motorway | yes | | foot | | + | motorway | | yes | | foot | diff --git a/features/bicycle/restrictions.feature b/features/bicycle/restrictions.feature index 6c5daf70b..27c5c353e 100644 --- a/features/bicycle/restrictions.feature +++ b/features/bicycle/restrictions.feature @@ -3,7 +3,7 @@ Feature: Bike - Turn restrictions Handle turn restrictions as defined by http://wiki.openstreetmap.org/wiki/Relation:restriction Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes. - Background: Use car routing + Background: Given the profile "bicycle" @no_turning @@ -14,11 +14,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -38,11 +38,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -62,11 +62,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -86,11 +86,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -110,11 +110,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -134,11 +134,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -158,11 +158,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -182,11 +182,11 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | nj | -1 | - | wj | -1 | - | ej | -1 | + | nodes | oneway | foot | + | sj | yes | no | + | nj | -1 | no | + | wj | -1 | no | + | ej | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | @@ -206,13 +206,13 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | no | - | xj | -1 | - | aj | -1 | - | bj | no | - | cj | -1 | - | dj | -1 | + | nodes | oneway | foot | + | sj | no | no | + | xj | -1 | no | + | aj | -1 | no | + | bj | no | no | + | cj | -1 | no | + | dj | -1 | no | And the relations | type | way:from | way:to | node:via | restriction | except | @@ -236,10 +236,10 @@ Feature: Bike - Turn restrictions | | s | | And the ways - | nodes | oneway | - | sj | yes | - | aj | no | - | bj | no | + | nodes | oneway | foot | + | sj | yes | no | + | aj | no | no | + | bj | no | no | And the relations | type | way:from | way:to | node:via | restriction | except | @@ -261,14 +261,14 @@ Feature: Bike - Turn restrictions | | | f | And the ways - | nodes | oneway | - | sj | yes | - | ja | yes | - | jb | yes | - | jc | yes | - | jd | yes | - | je | yes | - | jf | yes | + | nodes | oneway | foot | + | sj | yes | no | + | ja | yes | no | + | jb | yes | no | + | jc | yes | no | + | jd | yes | no | + | je | yes | no | + | jf | yes | no | And the relations | type | way:from | way:to | node:via | restriction | except | diff --git a/features/bicycle/way.feature b/features/bicycle/way.feature index ca157bd25..f5ad5bb87 100644 --- a/features/bicycle/way.feature +++ b/features/bicycle/way.feature @@ -4,32 +4,38 @@ Feature: Bike - Accessability of different way types Background: Given the profile "bicycle" - Scenario: Bike - Basic access + Scenario: Bike - Routability of way types Bikes are allowed on footways etc because you can pull your bike at a lower speed. - Given the profile "bicycle" + Pier is not allowed, since it's tagged using man_made=pier. Then routability should be - | highway | forw | - | (nil) | | - | motorway | | - | motorway_link | | - | trunk | | - | trunk_link | | - | primary | x | - | primary_link | x | - | secondary | x | - | secondary_link | x | - | tertiary | x | - | tertiary_link | x | - | residential | x | - | service | x | - | unclassified | x | - | living_street | x | - | road | x | - | track | x | - | path | x | - | footway | x | - | pedestrian | x | - | steps | x | - | pier | x | - | cycleway | x | - | bridleway | | + | highway | bothw | + | (nil) | | + | motorway | | + | motorway_link | | + | trunk | | + | trunk_link | | + | primary | x | + | primary_link | x | + | secondary | x | + | secondary_link | x | + | tertiary | x | + | tertiary_link | x | + | residential | x | + | service | x | + | unclassified | x | + | living_street | x | + | road | x | + | track | x | + | path | x | + | footway | x | + | pedestrian | x | + | steps | x | + | cycleway | x | + | bridleway | | + | pier | | + + Scenario: Bike - Routability of man_made structures + Then routability should be + | highway | man_made | bothw | + | (nil) | (nil) | | + | (nil) | pier | x | diff --git a/features/car/permissive.feature b/features/car/permissive.feature new file mode 100644 index 000000000..e69de29bb diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 6038126ee..8c518a6f0 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -12,7 +12,9 @@ restriction_exception_tags = { "bicycle", "vehicle", "access" } default_speed = 16 -main_speeds = { +walking_speed = 4 + +bicycle_speeds = { ["cycleway"] = 18, ["primary"] = 17, ["primary_link"] = 17, @@ -26,17 +28,14 @@ main_speeds = { ["road"] = 16, ["service"] = 16, ["track"] = 13, - ["path"] = 13, - ["footway"] = 12, - ["pedestrian"] = 12, - ["pier"] = 12, - ["steps"] = 2 + ["path"] = 13 + --["footway"] = 12, + --["pedestrian"] = 12, } pedestrian_speeds = { - ["footway"] = 5, - ["pedestrian"] = 5, - ["pier"] = 5, + ["footway"] = walking_speed, + ["pedestrian"] = walking_speed, ["steps"] = 2 } @@ -50,7 +49,7 @@ railway_speeds = { } platform_speeds = { - ["platform"] = 5 + ["platform"] = walking_speed } amenity_speeds = { @@ -58,6 +57,10 @@ amenity_speeds = { ["parking_entrance"] = 10 } +man_made_speeds = { + ["pier"] = walking_speed +} + route_speeds = { ["ferry"] = 5 } @@ -110,17 +113,36 @@ function way_function (way, numberOfNodesInWay) if(numberOfNodesInWay < 2) then return 0; end - - -- First, get the properties of each way that we come across + + -- initial routability check, filters out buildings, boundaries, etc local highway = way.tags:Find("highway") + local route = way.tags:Find("route") + local man_made = way.tags:Find("man_made") + local railway = way.tags:Find("railway") + local amenity = way.tags:Find("amenity") + local public_transport = way.tags:Find("public_transport") + if (not highway or highway == '') and + (not route or route == '') and + (not railway or railway=='') and + (not amenity or amenity=='') and + (not man_made or man_made=='') and + (not public_transport or public_transport=='') + then + return 0 + end + + -- access + local access = Access.find_access_tag(way, access_tags_hierachy) + if access_tag_blacklist[access] then + return 0 + end + + + -- other tags local name = way.tags:Find("name") local ref = way.tags:Find("ref") local junction = way.tags:Find("junction") - local route = way.tags:Find("route") - local railway = way.tags:Find("railway") - local public_transport = way.tags:Find("public_transport") local maxspeed = parseMaxspeed(way.tags:Find ( "maxspeed") ) - local man_made = way.tags:Find("man_made") local barrier = way.tags:Find("barrier") local oneway = way.tags:Find("oneway") local onewayClass = way.tags:Find("oneway:bicycle") @@ -130,23 +152,7 @@ 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 = Access.find_access_tag(way, access_tags_hierachy) - - -- initial routability check, filters out buildings, boundaries, etc - if (not highway or highway == '') and - (not route or route == '') and - (not railway or railway=='') and - (not amenity or amenity=='') and - (not public_transport or public_transport=='') - then - return 0 - end - - -- access - if access_tag_blacklist[access] then - return 0 - end + local foot = way.tags:Find("foot") -- name if "" ~= ref then @@ -157,8 +163,9 @@ function way_function (way, numberOfNodesInWay) way.name = highway -- if no name exists, use way type end + -- speed if route_speeds[route] then - -- ferries + -- ferries (doesn't cover routes tagged using relations) way.direction = Way.bidirectional way.ignore_in_grid = true if durationIsValid(duration) then @@ -179,34 +186,32 @@ function way_function (way, numberOfNodesInWay) way.speed = railway_speeds[railway] way.direction = Way.bidirectional end - elseif pedestrian_speeds[highway] and main_speeds[highway] then - -- pedestrian areas - if access_tag_whitelist[access] then - way.speed = main_speeds[highway] -- biking - else - way.speed = pedestrian_speeds[highway] -- pushing bikes - end elseif amenity and amenity_speeds[amenity] then -- parking areas way.speed = amenity_speeds[amenity] - else + elseif bicycle_speeds[highway] then -- regular ways - if main_speeds[highway] then - way.speed = main_speeds[highway] - elseif main_speeds[man_made] then - way.speed = main_speeds[man_made] - elseif access_tag_whitelist[access] then - way.speed = default_speed - end - end - - -- maxspeed - if take_minimum_of_speeds then - if maxspeed and maxspeed>0 then - way.speed = math.min(way.speed, maxspeed) - end - end - + way.speed = bicycle_speeds[highway] + elseif access and access_tag_whitelist[access] then + -- unknown way, but valid access tag + way.speed = default_speed + else + -- biking not allowed, maybe we can push our bike? + -- essentially requires pedestrian profiling, for example foot=no mean we can't push a bike + -- TODO: if we can push, the way should be marked as pedestrion mode, but there's no way to do it yet from lua.. + if foot ~= 'no' then + if pedestrian_speeds[highway] then + -- pedestrian-only ways and areas + way.speed = pedestrian_speeds[highway] + elseif man_made and man_made_speeds[man_made] then + -- man made structures + way.speed = man_made_speeds[man_made] + elseif foot == 'yes' then + way.speed = walking_speed + end + end + end + -- direction way.direction = Way.bidirectional local impliedOneway = false @@ -249,15 +254,40 @@ function way_function (way, numberOfNodesInWay) way.direction = Way.oneway end + -- pushing bikes + if bicycle_speeds[highway] or pedestrian_speeds[highway] then + if foot ~= 'no' then + if way.direction == Way.oneway then + way.backward_speed = walking_speed + elseif way.direction == Way.opposite then + way.backward_speed = walking_speed + way.speed = way.speed + end + end + if way.backward_speed == way.speed then + -- TODO: no way yet to mark a way as pedestrian mode if forward/backward speeds are equal + way.direction = Way.bidirectional + end + end + + -- cycleways if cycleway and cycleway_tags[cycleway] then - way.speed = main_speeds["cycleway"] + way.speed = bicycle_speeds["cycleway"] elseif cycleway_left and cycleway_tags[cycleway_left] then - way.speed = main_speeds["cycleway"] + way.speed = bicycle_speeds["cycleway"] elseif cycleway_right and cycleway_tags[cycleway_right] then - way.speed = main_speeds["cycleway"] + way.speed = bicycle_speeds["cycleway"] end + -- maxspeed + -- TODO: maxspeed of backward direction + if take_minimum_of_speeds then + if maxspeed and maxspeed>0 then + way.speed = math.min(way.speed, maxspeed) + end + end + way.type = 1 return 1 end