car profile: handle forward/backward access

This commit is contained in:
Emil Tin 2016-12-01 20:10:26 +01:00 committed by Daniel J. H
parent 532cbfce13
commit 9461c83511
3 changed files with 52 additions and 7 deletions

View File

@ -30,6 +30,35 @@ Feature: Car - Restricted access
| | | no | yes | x | | | | no | yes | x |
| | | yes | no | | | | | yes | no | |
Scenario: Car - Access tag hierarchy and forward/backward
Then routability should be
| access | access:forward | access:backward | motorcar | motorcar:forward | motorcar:backward | forw | backw |
| | | | | | | x | x |
| yes | | | | | | x | x |
| yes | no | | | | | | x |
| yes | yes | | no | | | | |
| yes | yes | | yes | no | | | x |
| yes | | | | | | x | x |
| yes | | no | | | | x | |
| yes | | yes | no | | | | |
| yes | | yes | yes | | no | x | |
| no | | | | | | | |
| no | yes | | | | | x | |
| no | no | | yes | | | x | x |
| no | no | | no | yes | | x | |
| no | | | | | | | |
| no | | yes | | | | | x |
| no | | no | yes | | | x | x |
| no | | no | no | | yes | | x |
| | no | | | no | | | x |
| | | no | | | no | x | |
| | no | | | | no | | |
| | | no | no | | | | |
| | no | | | yes | | x | x |
| | | no | | | yes | x | x |
| | yes | | | no | | | x |
| | | yes | | | no | x | |
Scenario: Car - Access tag hierarchy on nodes Scenario: Car - Access tag hierarchy on nodes
Then routability should be Then routability should be
| node/access | node/vehicle | node/motor_vehicle | node/motorcar | bothw | | node/access | node/vehicle | node/motor_vehicle | node/motorcar | bothw |

View File

@ -377,8 +377,18 @@ end
-- check accessibility by traversing our acces tag hierarchy -- check accessibility by traversing our acces tag hierarchy
function handle_access(way,result,data) function handle_access(way,result,data)
data.access = find_access_tag(way, access_tags_hierarchy) data.forward_access, data.backward_access =
if access_tag_blacklist[data.access] then Directional.get_values_by_set(way,data,access_tags_hierarchy)
if access_tag_blacklist[data.forward_access] then
result.forward_mode = mode.inaccessible
end
if access_tag_blacklist[data.backward_access] then
result.backward_mode = mode.inaccessible
end
if result.forward_mode == mode.inaccessible and result.backward_mode == mode.inaccessible then
return false return false
end end
end end
@ -430,8 +440,11 @@ function handle_speed(way,result,data)
result.backward_speed = highway_speed result.backward_speed = highway_speed
else else
-- Set the avg speed on ways that are marked accessible -- Set the avg speed on ways that are marked accessible
if access_tag_whitelist[data.access] then if access_tag_whitelist[data.forward_access] then
result.forward_speed = speed_profile["default"] result.forward_speed = speed_profile["default"]
end
if access_tag_whitelist[data.backward_access] then
result.backward_speed = speed_profile["default"] result.backward_speed = speed_profile["default"]
end end
end end
@ -530,7 +543,8 @@ end
-- Set access restriction flag if access is allowed under certain restrictions only -- Set access restriction flag if access is allowed under certain restrictions only
function handle_restricted(way,result,data) function handle_restricted(way,result,data)
if data.access and access_tag_restricted[data.access] then if (data.forward_access and access_tag_restricted[data.forward_access]) or
(data.backward_access and access_tag_restricted[data.backward_access]) then
result.is_access_restricted = true result.is_access_restricted = true
end end
end end

View File

@ -43,8 +43,10 @@ mode = {
-- input tags, normally extracted from OSM data -- input tags, normally extracted from OSM data
local way = { local way = {
highway = 'motorway', highway = 'primary',
name = 'Main Street', name = 'Main Street',
--access = 'no'
["access:forward"] = 'no'
--width = '3', --width = '3',
--maxspeed = '30', --maxspeed = '30',
--['maxspeed:advisory'] = '25', --['maxspeed:advisory'] = '25',
@ -56,8 +58,8 @@ local way = {
--route = 'ferry', --route = 'ferry',
--duration = '00:01:00', --duration = '00:01:00',
--hov = 'designated', --hov = 'designated',
["hov:lanes:forward"] = 'designated', --hov:lanes:forward"] = 'designated',
--access = 'no'
--destination = 'Berlin', --destination = 'Berlin',
--["destination:ref"] = 'Nuremberg', --["destination:ref"] = 'Nuremberg',
--["destination:ref:forward"] = 'Hamburg;Dresden', --["destination:ref:forward"] = 'Hamburg;Dresden',