parse access tag hierachy in bike profile
This commit is contained in:
parent
c1a08af00d
commit
8e6b7766a1
@ -8,18 +8,31 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access
|
||||
Scenario: Bike - Access tag hierachy
|
||||
Then routability should be
|
||||
| access | vehicle | bicycle | bothw |
|
||||
| | | | x |
|
||||
| yes | | | x |
|
||||
| no | | | |
|
||||
| | yes | | x |
|
||||
| yes | yes | | x |
|
||||
| no | yes | | x |
|
||||
| | no | | |
|
||||
| yes | no | | |
|
||||
| no | no | | |
|
||||
| | | yes | x |
|
||||
| yes | | yes | x |
|
||||
| no | | yes | x |
|
||||
| | yes | yes | x |
|
||||
| yes | yes | yes | x |
|
||||
| no | yes | yes | x |
|
||||
| | no | yes | x |
|
||||
| yes | no | yes | x |
|
||||
| no | no | yes | x |
|
||||
| | | no | |
|
||||
| yes | | no | |
|
||||
| no | | no | |
|
||||
| | yes | no | |
|
||||
| yes | yes | no | |
|
||||
| no | yes | no | |
|
||||
| | no | no | |
|
||||
| yes | no | no | |
|
||||
| no | no | no | |
|
||||
|
||||
|
@ -24,25 +24,15 @@ Feature: Barriers
|
||||
| node/barrier | node/access | bothw |
|
||||
| bollard | | x |
|
||||
| bollard | yes | x |
|
||||
| bollard | bicycle | x |
|
||||
| bollard | vehicle | x |
|
||||
| bollard | motorcar | x |
|
||||
| bollard | motor_vehicle | x |
|
||||
| bollard | permissive | x |
|
||||
| bollard | designated | x |
|
||||
| bollard | no | |
|
||||
| bollard | foot | |
|
||||
| bollard | private | |
|
||||
| bollard | agricultural | |
|
||||
| wall | | |
|
||||
| wall | yes | x |
|
||||
| wall | bicycle | x |
|
||||
| wall | vehicle | x |
|
||||
| wall | motorcar | x |
|
||||
| wall | motor_vehicle | x |
|
||||
| wall | permissive | x |
|
||||
| wall | designated | x |
|
||||
| wall | no | |
|
||||
| wall | foot | |
|
||||
| wall | private | |
|
||||
| wall | agricultural | |
|
||||
|
@ -24,25 +24,15 @@ Feature: Car - Barriers
|
||||
| node/barrier | node/access | bothw |
|
||||
| gate | | x |
|
||||
| gate | yes | x |
|
||||
| gate | vehicle | x |
|
||||
| gate | motorcar | x |
|
||||
| gate | motor_vehicle | x |
|
||||
| gate | permissive | x |
|
||||
| gate | designated | x |
|
||||
| gate | no | |
|
||||
| gate | foot | |
|
||||
| gate | bicycle | |
|
||||
| gate | private | |
|
||||
| gate | agricultural | |
|
||||
| wall | | |
|
||||
| wall | yes | x |
|
||||
| wall | vehicle | x |
|
||||
| wall | motorcar | x |
|
||||
| wall | motor_vehicle | x |
|
||||
| wall | permissive | x |
|
||||
| wall | designated | x |
|
||||
| wall | no | |
|
||||
| wall | foot | |
|
||||
| wall | bicycle | |
|
||||
| wall | private | |
|
||||
| wall | agricultural | |
|
||||
|
@ -1,9 +1,10 @@
|
||||
-- Begin of globals
|
||||
|
||||
barrier_whitelist = { [""] = true, ["bollard"] = true, ["entrance"] = true, ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["no"] = true, ["sally_port"] = true, ["gate"] = true}
|
||||
access_tag_whitelist = { ["yes"] = true, ["bicycle"] = true, ["vehicle"] = true, ["permissive"] = true, ["designated"] = true }
|
||||
access_tag_blacklist = { ["no"] = true, ["foot"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
|
||||
access_tag_whitelist = { ["yes"] = true, ["permissive"] = true, ["designated"] = true }
|
||||
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
|
||||
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
|
||||
access_tags_hierachy = { "bicycle", "vehicle", "access" }
|
||||
service_tag_restricted = { ["parking_aisle"] = true }
|
||||
ignore_in_grid = { ["ferry"] = true }
|
||||
|
||||
@ -41,9 +42,20 @@ u_turn_penalty = 20
|
||||
|
||||
-- End of globals
|
||||
|
||||
--find first tag in access hierachy which is set
|
||||
function find_access_tag(source)
|
||||
for i,v in ipairs(access_tags_hierachy) do
|
||||
local tag = source.tags:Find(v)
|
||||
if tag ~= '' then --and tag ~= "" then
|
||||
return tag
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function node_function (node)
|
||||
local barrier = node.tags:Find ("barrier")
|
||||
local access = node.tags:Find ("access")
|
||||
local access = find_access_tag(node)
|
||||
local traffic_signal = node.tags:Find("highway")
|
||||
|
||||
-- flag node if it carries a traffic light
|
||||
@ -52,20 +64,18 @@ function node_function (node)
|
||||
end
|
||||
|
||||
-- parse access and barrier tags
|
||||
if access ~= "" then
|
||||
if access and access ~= "" then
|
||||
if access_tag_blacklist[access] then
|
||||
node.bollard = true
|
||||
else
|
||||
node.bollard = false
|
||||
end
|
||||
elseif barrier ~= "" then
|
||||
elseif barrier and barrier ~= "" then
|
||||
if barrier_whitelist[barrier] then
|
||||
node.bollard = false
|
||||
else
|
||||
node.bollard = true
|
||||
end
|
||||
else
|
||||
node.bollard = false
|
||||
end
|
||||
|
||||
return 1
|
||||
@ -92,11 +102,11 @@ function way_function (way, numberOfNodesInWay)
|
||||
local duration = way.tags:Find("duration")
|
||||
local service = way.tags:Find("service")
|
||||
local area = way.tags:Find("area")
|
||||
local access = way.tags:Find("access")
|
||||
local access = find_access_tag(way)
|
||||
|
||||
|
||||
-- Check if we are allowed to access the way
|
||||
if access_tag_blacklist[access] ~=nil and access_tag_blacklist[access] then
|
||||
if access_tag_blacklist[access] then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user