diff --git a/features/car/access.feature b/features/car/access.feature index 9eedbfd21..e46590c49 100644 --- a/features/car/access.feature +++ b/features/car/access.feature @@ -30,6 +30,35 @@ Feature: Car - Restricted access | | | no | yes | x | | | | 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 Then routability should be | node/access | node/vehicle | node/motor_vehicle | node/motorcar | bothw | diff --git a/profiles/car.lua b/profiles/car.lua index 204ec8d4b..5f55b2bc8 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -377,8 +377,18 @@ end -- check accessibility by traversing our acces tag hierarchy function handle_access(way,result,data) - data.access = find_access_tag(way, access_tags_hierarchy) - if access_tag_blacklist[data.access] then + data.forward_access, data.backward_access = + 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 end end @@ -430,8 +440,11 @@ function handle_speed(way,result,data) result.backward_speed = highway_speed else -- 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"] + end + + if access_tag_whitelist[data.backward_access] then result.backward_speed = speed_profile["default"] end end @@ -530,7 +543,8 @@ end -- Set access restriction flag if access is allowed under certain restrictions only 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 end end diff --git a/profiles/debug.lua b/profiles/debug.lua index d8d6b41f0..40e5076f5 100644 --- a/profiles/debug.lua +++ b/profiles/debug.lua @@ -43,8 +43,10 @@ mode = { -- input tags, normally extracted from OSM data local way = { - highway = 'motorway', + highway = 'primary', name = 'Main Street', + --access = 'no' + ["access:forward"] = 'no' --width = '3', --maxspeed = '30', --['maxspeed:advisory'] = '25', @@ -56,8 +58,8 @@ local way = { --route = 'ferry', --duration = '00:01:00', --hov = 'designated', - ["hov:lanes:forward"] = 'designated', - --access = 'no' + --hov:lanes:forward"] = 'designated', + --destination = 'Berlin', --["destination:ref"] = 'Nuremberg', --["destination:ref:forward"] = 'Hamburg;Dresden',