Only allow restricted access for road of certain highway type

This commit is contained in:
Patrick Niklaus
2017-03-03 12:38:11 +00:00
committed by Patrick Niklaus
parent 93cdd8bb46
commit cc3a4899a2
5 changed files with 65 additions and 16 deletions
+2
View File
@@ -67,6 +67,8 @@ local profile = {
restricted_access_tag_list = Set { },
restricted_highway_whitelist = Set { },
access_tags_hierarchy = Sequence {
'bicycle',
'vehicle',
+21 -2
View File
@@ -74,7 +74,11 @@ local profile = {
'agricultural',
'forestry',
'emergency',
'psv'
'psv',
'customer',
'private',
'delivery',
'destination'
},
restricted_access_tag_list = Set {
@@ -137,6 +141,21 @@ local profile = {
["drive-thru"] = 0.5
},
restricted_highway_whitelist = Set {
'motorway',
'motorway_link',
'trunk',
'trunk_link',
'primary',
'primary_link',
'secondary',
'secondary_link',
'tertiary',
'tertiary_link',
'residential',
'living_street',
},
route_speeds = {
ferry = 5,
shuttle_train = 10
@@ -259,7 +278,7 @@ function node_function (node, result)
-- parse access and barrier tags
local access = find_access_tag(node, profile.access_tags_hierarchy)
if access then
if profile.access_tag_blacklist[access] then
if profile.access_tag_blacklist[access] and not profile.restricted_access_tag_list[access] then
result.barrier = true
end
else
+2
View File
@@ -53,6 +53,8 @@ local profile = {
restricted_access_tag_list = Set { },
restricted_highway_whitelist = Set { },
access_tags_hierarchy = Sequence {
'foot',
'access'
+13 -10
View File
@@ -212,25 +212,28 @@ function Handlers.handle_access(way,result,data,profile)
data.forward_access, data.backward_access =
Tags.get_forward_backward_by_set(way,data,profile.access_tags_hierarchy)
if profile.access_tag_blacklist[data.forward_access] then
-- only allow a subset of roads that are marked as restricted
if profile.restricted_highway_whitelist[data.highway] then
if profile.restricted_access_tag_list[data.forward_access] then
result.forward_restricted = true
end
if profile.restricted_access_tag_list[data.backward_access] then
result.backward_restricted = true
end
end
if profile.access_tag_blacklist[data.forward_access] and not result.forward_restricted then
result.forward_mode = mode.inaccessible
end
if profile.access_tag_blacklist[data.backward_access] then
if profile.access_tag_blacklist[data.backward_access] and not result.backward_restricted then
result.backward_mode = mode.inaccessible
end
if result.forward_mode == mode.inaccessible and result.backward_mode == mode.inaccessible then
return false
end
if profile.restricted_access_tag_list[data.forward_access] then
result.forward_restricted = true
end
if profile.restricted_access_tag_list[data.backward_access] then
result.backward_restricted = true
end
end
-- handle speed (excluding maxspeed)