Adding functionality for turn restriction exceptions to profile

This commit is contained in:
DennisOSRM
2013-01-05 17:32:39 +01:00
parent fa050ad616
commit 64988ed831
4 changed files with 229 additions and 22 deletions
+7 -20
View File
@@ -1,4 +1,5 @@
-- Begin of globals
require("lib/access")
barrier_whitelist = { ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["sally_port"] = true, ["gate"] = true}
access_tag_whitelist = { ["yes"] = true, ["motorcar"] = true, ["motor_vehicle"] = true, ["vehicle"] = true, ["permissive"] = true, ["designated"] = true }
@@ -8,6 +9,7 @@ access_tags = { "motorcar", "motor_vehicle", "vehicle" }
access_tags_hierachy = { "motorcar", "motor_vehicle", "vehicle", "access" }
service_tag_restricted = { ["parking_aisle"] = true }
ignore_in_grid = { ["ferry"] = true }
restriction_exception_tags = { "motorcar", "motor_vehicle", "vehicle" }
speed_profile = {
["motorway"] = 90,
@@ -39,24 +41,9 @@ u_turn_penalty = 20
-- End of globals
--find first tag in access hierachy which is set
local function find_access_tag(source)
for i,v in ipairs(access_tags_hierachy) do
if source.tags:Holds(v) then
local tag = source.tags:Find(v)
if tag ~= '' then --and tag ~= "" then
return tag
end
end
end
return nil
end
local function find_in_keyvals(keyvals, tag)
if keyvals:Holds(tag) then
return keyvals:Find(tag)
else
return nil
function get_exceptions(vector)
for i,v in ipairs(restriction_exception_tags) do
vector:Add(v)
end
end
@@ -76,7 +63,7 @@ end
function node_function (node)
local barrier = node.tags:Find ("barrier")
local access = find_access_tag(node)
local access = Access.find_access_tag(node, access_tags_hierachy)
local traffic_signal = node.tags:Find("highway")
--flag node if it carries a traffic light
@@ -121,7 +108,7 @@ 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 = find_access_tag(way)
local access = Access.find_access_tag(way, access_tags_hierachy)
-- Second, parse the way according to these properties