better handling of access and barrier tags

This commit is contained in:
Emil Tin
2012-10-03 19:04:56 +02:00
parent 30465f08ac
commit 4b00557fda
13 changed files with 162 additions and 159 deletions
+24 -17
View File
@@ -1,12 +1,9 @@
-- Bicycle profile
-- Begin of globals
bollards_whitelist = { [""] = true, ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["no"] = true, ["sally_port"] = true, ["gate"] = true}
access_tag_whitelist = { ["yes"] = true, ["vehicle"] = true, ["permissive"] = true, ["designated"] = true }
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
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_restricted = { ["destination"] = true, ["delivery"] = true }
access_tags = { "bicycle", "vehicle" }
service_tag_restricted = { ["parking_aisle"] = true }
ignore_in_grid = { ["ferry"] = true }
@@ -49,23 +46,28 @@ function node_function (node)
local access = node.tags:Find ("access")
local traffic_signal = node.tags:Find("highway")
--flag node if it carries a traffic light
-- flag node if it carries a traffic light
if traffic_signal == "traffic_signals" then
node.traffic_light = true;
node.traffic_light = true
end
if obey_bollards then
--flag node as unpassable if it black listed as unpassable
if access_tag_blacklist[barrier] then
node.bollard = true;
-- parse access and barrier tags
if access ~= "" then
if access_tag_blacklist[access] then
node.bollard = true
else
node.bollard = false
end
--reverse the previous flag if there is an access tag specifying entrance
if node.bollard and not bollards_whitelist[barrier] and not access_tag_whitelist[barrier] then
node.bollard = false;
elseif barrier ~= "" then
if barrier_whitelist[barrier] then
node.bollard = false
else
node.bollard = true
end
else
node.bollard = false
end
return 1
end
@@ -93,6 +95,11 @@ function way_function (way, numberOfNodesInWay)
local access = way.tags:Find("access")
-- Check if we are allowed to access the way
if access_tag_blacklist[access] ~=nil and access_tag_blacklist[access] then
return 0
end
-- Set the name that will be used for instructions
if "" ~= ref then
way.name = ref
+20 -17
View File
@@ -2,7 +2,7 @@
barrier_whitelist = { ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["no"] = true, ["sally_port"] = true, ["gate"] = true}
access_tag_whitelist = { ["yes"] = true, ["motorcar"] = true, ["motor_vehicle"] = true, ["vehicle"] = true, ["permissive"] = true, ["designated"] = true }
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
access_tag_blacklist = { ["no"] = true, ["foot"] = true, ["bicycle"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
access_tags = { "motorcar", "motor_vehicle", "vehicle" }
service_tag_restricted = { ["parking_aisle"] = true }
@@ -44,26 +44,29 @@ function node_function (node)
local access = node.tags:Find ("access")
local traffic_signal = node.tags:Find("highway")
--flag node if it carries a traffic light
-- flag node if it carries a traffic light
if traffic_signal == "traffic_signals" then
node.traffic_light = true;
node.traffic_light = true
end
if "" ~= barrier and obey_bollards then
node.bollard = true; -- flag as unpassable and then check
if "yes" == access then
node.bollard = false;
return
end
--reverse the previous flag if there is an access tag specifying entrance
if node.bollard and (barrier_whitelist[barrier] or access_tag_whitelist[access]) then
node.bollard = false;
return
-- parse access and barrier tags
if access ~= "" then
if access_tag_blacklist[access] then
node.bollard = true
else
node.bollard = false
end
elseif barrier ~= "" then
if barrier_whitelist[barrier] then
node.bollard = false
else
node.bollard = true
end
else
node.bollard = false
end
end
return 1
end
function way_function (way, numberOfNodesInWay)
-1
View File
@@ -11,7 +11,6 @@ service_tag_restricted = { ["parking_aisle"] = true }
ignore_in_grid = { ["ferry"] = true }
speed_profile = {
["trunk_link"] = 5,
["primary"] = 5,
["primary_link"] = 5,
["secondary"] = 5,