test access tags
This commit is contained in:
parent
2798c5a48d
commit
81b9e3b4cb
@ -1,80 +1,66 @@
|
|||||||
@routing @access
|
@routing @access
|
||||||
Feature: Default speedprofiles
|
Feature: Restricted access
|
||||||
Basic accessability of various way types depending on speedprofile.
|
|
||||||
|
|
||||||
Scenario: Basic access for cars
|
Background:
|
||||||
Given the speedprofile "car"
|
Given the speedprofile "bicycle"
|
||||||
|
|
||||||
|
Scenario: Access tags on ways
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | forw |
|
| access | bothw |
|
||||||
| motorway | x |
|
| yes | x |
|
||||||
| motorway_link | x |
|
| motorcar | x |
|
||||||
| trunk | x |
|
| motor_vehicle | x |
|
||||||
| trunk_link | x |
|
| vehicle | x |
|
||||||
| primary | x |
|
| permissive | x |
|
||||||
| secondary | x |
|
| designated | x |
|
||||||
| tertiary | x |
|
| no | |
|
||||||
| residential | x |
|
| private | |
|
||||||
| service | x |
|
| agricultural | |
|
||||||
| unclassified | x |
|
| forestry | |
|
||||||
| living_street | x |
|
| designated | |
|
||||||
| road | |
|
| some_tag | x |
|
||||||
| track | |
|
|
||||||
| path | |
|
|
||||||
| footway | |
|
|
||||||
| pedestrian | |
|
|
||||||
| steps | |
|
|
||||||
| pier | |
|
|
||||||
| cycleway | |
|
|
||||||
| bridleway | |
|
|
||||||
|
|
||||||
Scenario: Basic access for bicycles
|
Scenario: Access tags for other modes should have no effect
|
||||||
Bikes are allowed on footways etc because you can pull your bike at a lower speed.
|
|
||||||
Given the speedprofile "bicycle"
|
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | forw |
|
| access | bothw |
|
||||||
| motorway | |
|
| ufo:yes | x |
|
||||||
| motorway_link | |
|
| ufo:motorcar | x |
|
||||||
| trunk | |
|
| ufo:motor_vehicle | x |
|
||||||
| trunk_link | |
|
| ufo:vehicle | x |
|
||||||
| primary | x |
|
| ufo:permissive | x |
|
||||||
| secondary | x |
|
| ufo:designated | x |
|
||||||
| tertiary | x |
|
| ufo:no | x |
|
||||||
| residential | x |
|
| ufo:private | x |
|
||||||
| service | x |
|
| ufo:agricultural | x |
|
||||||
| unclassified | x |
|
| ufo:forestry | x |
|
||||||
| living_street | x |
|
| ufo:designated | x |
|
||||||
| road | x |
|
| ufo:some_tag | x |
|
||||||
| track | x |
|
|
||||||
| path | x |
|
|
||||||
| footway | x |
|
|
||||||
| pedestrian | x |
|
|
||||||
| steps | x |
|
|
||||||
| pier | x |
|
|
||||||
| cycleway | x |
|
|
||||||
| bridleway | |
|
|
||||||
|
|
||||||
Scenario: Basic access for walking
|
Scenario: Access tags on nodes
|
||||||
Given the speedprofile "foot"
|
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | forw |
|
| node:access | bothw |
|
||||||
| motorway | |
|
| yes | x |
|
||||||
| motorway_link | |
|
| motorcar | x |
|
||||||
| trunk | |
|
| motor_vehicle | x |
|
||||||
| trunk_link | x |
|
| vehicle | x |
|
||||||
| primary | x |
|
| permissive | x |
|
||||||
| secondary | x |
|
| designated | x |
|
||||||
| tertiary | x |
|
| no | |
|
||||||
| residential | x |
|
| private | |
|
||||||
| service | x |
|
| agricultural | |
|
||||||
| unclassified | x |
|
| forestry | |
|
||||||
| living_street | x |
|
| designated | |
|
||||||
| road | x |
|
| some_tag | x |
|
||||||
| track | x |
|
|
||||||
| path | x |
|
|
||||||
| footway | x |
|
|
||||||
| pedestrian | x |
|
|
||||||
| steps | x |
|
|
||||||
| pier | x |
|
|
||||||
| cycleway | x |
|
|
||||||
| bridleway | |
|
|
||||||
|
|
||||||
|
Scenario: Access tags on both nodes and way
|
||||||
|
Then routability should be
|
||||||
|
| access | node:access | bothw |
|
||||||
|
| yes | yes | x |
|
||||||
|
| yes | no | |
|
||||||
|
| yes | some_tag | |
|
||||||
|
| no | yes | |
|
||||||
|
| no | no | |
|
||||||
|
| no | some_tag | |
|
||||||
|
| some_tag | yes | |
|
||||||
|
| some_tag | no | |
|
||||||
|
| some_tag | some_tag | |
|
||||||
|
70
features/destination.feature
Normal file
70
features/destination.feature
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
@routing @destination
|
||||||
|
Feature: Destination only, no passing through
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the speedprofile "car"
|
||||||
|
|
||||||
|
Scenario: Destination only street
|
||||||
|
Given the node map
|
||||||
|
| a | | | | |
|
||||||
|
| | b | c | d | |
|
||||||
|
| | | | | e |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | access |
|
||||||
|
| ab | |
|
||||||
|
| bcd | destination |
|
||||||
|
| de | |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | b | ab |
|
||||||
|
| a | c | ab,bcd |
|
||||||
|
| a | d | ab,bcd |
|
||||||
|
| a | e | ab,bcd,de |
|
||||||
|
| e | d | de |
|
||||||
|
| e | c | de,bcd |
|
||||||
|
| e | b | de,bcd |
|
||||||
|
| e | a | de,bcd,ab |
|
||||||
|
| b | c | bcd |
|
||||||
|
| b | d | bcd |
|
||||||
|
| d | c | bcd |
|
||||||
|
| d | b | bcd |
|
||||||
|
|
||||||
|
Scenario: Series of destination only streets
|
||||||
|
Given the node map
|
||||||
|
| a | | c | | e |
|
||||||
|
| | b | | d | |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | access |
|
||||||
|
| ab | |
|
||||||
|
| bc | destination |
|
||||||
|
| cd | destination |
|
||||||
|
| de | destination |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | b | ab |
|
||||||
|
| a | c | ab |
|
||||||
|
| a | d | ab |
|
||||||
|
| a | e | ab |
|
||||||
|
|
||||||
|
Scenario: Routing inside a destination only area
|
||||||
|
Given the node map
|
||||||
|
| a | | c | | e |
|
||||||
|
| | b | | d | |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | access |
|
||||||
|
| ab | destination |
|
||||||
|
| bc | destination |
|
||||||
|
| cd | destination |
|
||||||
|
| de | destination |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | e | ab,bc,cd,de |
|
||||||
|
| e | a | de,cd,bc,ab |
|
||||||
|
| b | d | bc,cd |
|
||||||
|
| d | b | cd,bc |
|
@ -150,8 +150,8 @@ Then /^routability should be$/ do |table|
|
|||||||
build_ways_from_table table
|
build_ways_from_table table
|
||||||
reprocess
|
reprocess
|
||||||
actual = []
|
actual = []
|
||||||
if table.headers&["forw","backw"] == []
|
if table.headers&["forw","backw","bothw"] == []
|
||||||
raise "*** routability tabel must contain either 'forw' or 'backw' column"
|
raise "*** routability tabel must contain either 'forw', 'backw' or 'bothw' column"
|
||||||
end
|
end
|
||||||
OSRMLauncher.new do
|
OSRMLauncher.new do
|
||||||
table.hashes.each_with_index do |row,i|
|
table.hashes.each_with_index do |row,i|
|
||||||
@ -159,9 +159,9 @@ Then /^routability should be$/ do |table|
|
|||||||
attempts = []
|
attempts = []
|
||||||
['forw','backw'].each do |direction|
|
['forw','backw'].each do |direction|
|
||||||
if table.headers.include? direction
|
if table.headers.include? direction
|
||||||
if direction == 'forw'
|
if direction == 'forw' || direction == 'bothw'
|
||||||
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(3+WAY_SPACING*i)*@zoom}")
|
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(3+WAY_SPACING*i)*@zoom}")
|
||||||
elsif direction == 'backw'
|
elsif direction == 'backw' || direction == 'bothw'
|
||||||
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(3+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}")
|
response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(3+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}")
|
||||||
end
|
end
|
||||||
got[direction] = route_status response
|
got[direction] = route_status response
|
||||||
|
@ -76,7 +76,8 @@ def build_ways_from_table table
|
|||||||
tags.reject! { |k,v| v=='' }
|
tags.reject! { |k,v| v=='' }
|
||||||
|
|
||||||
# sort tag keys in the form of 'node/....'
|
# sort tag keys in the form of 'node/....'
|
||||||
way_tags = {}
|
way_tags = { 'highway' => 'primary' }
|
||||||
|
|
||||||
node_tags = {}
|
node_tags = {}
|
||||||
tags.each_pair do |k,v|
|
tags.each_pair do |k,v|
|
||||||
if k =~ /node\/(.*)/
|
if k =~ /node\/(.*)/
|
||||||
|
@ -7,4 +7,8 @@ class OSRMError < StandardError
|
|||||||
@code = code
|
@code = code
|
||||||
@msg = msg
|
@msg = msg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
@msg
|
||||||
|
end
|
||||||
end
|
end
|
79
features/way.feature
Normal file
79
features/way.feature
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
@routing @way
|
||||||
|
Feature: Accessability of different way types
|
||||||
|
|
||||||
|
Scenario: Basic access for cars
|
||||||
|
Given the speedprofile "car"
|
||||||
|
Then routability should be
|
||||||
|
| highway | forw |
|
||||||
|
| motorway | x |
|
||||||
|
| motorway_link | x |
|
||||||
|
| trunk | x |
|
||||||
|
| trunk_link | x |
|
||||||
|
| primary | x |
|
||||||
|
| secondary | x |
|
||||||
|
| tertiary | x |
|
||||||
|
| residential | x |
|
||||||
|
| service | x |
|
||||||
|
| unclassified | x |
|
||||||
|
| living_street | x |
|
||||||
|
| road | |
|
||||||
|
| track | |
|
||||||
|
| path | |
|
||||||
|
| footway | |
|
||||||
|
| pedestrian | |
|
||||||
|
| steps | |
|
||||||
|
| pier | |
|
||||||
|
| cycleway | |
|
||||||
|
| bridleway | |
|
||||||
|
|
||||||
|
Scenario: Basic access for bicycles
|
||||||
|
Bikes are allowed on footways etc because you can pull your bike at a lower speed.
|
||||||
|
Given the speedprofile "bicycle"
|
||||||
|
Then routability should be
|
||||||
|
| highway | forw |
|
||||||
|
| motorway | |
|
||||||
|
| motorway_link | |
|
||||||
|
| trunk | |
|
||||||
|
| trunk_link | |
|
||||||
|
| primary | x |
|
||||||
|
| secondary | x |
|
||||||
|
| tertiary | 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 | |
|
||||||
|
|
||||||
|
Scenario: Basic access for walking
|
||||||
|
Given the speedprofile "foot"
|
||||||
|
Then routability should be
|
||||||
|
| highway | forw |
|
||||||
|
| motorway | |
|
||||||
|
| motorway_link | |
|
||||||
|
| trunk | |
|
||||||
|
| trunk_link | x |
|
||||||
|
| primary | x |
|
||||||
|
| secondary | x |
|
||||||
|
| tertiary | 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 | |
|
||||||
|
|
Loading…
Reference in New Issue
Block a user