more robust check for parsed ways
This commit is contained in:
+15
-11
@@ -102,32 +102,32 @@ function node_function (node)
|
||||
end
|
||||
|
||||
function way_function (way)
|
||||
-- initial routability check, filters out buildings, boundaries, etc
|
||||
-- initial routability check, filters out buildings, boundaries, etc
|
||||
local highway = way.tags:Find("highway")
|
||||
local route = way.tags:Find("route")
|
||||
local man_made = way.tags:Find("man_made")
|
||||
local railway = way.tags:Find("railway")
|
||||
local amenity = way.tags:Find("amenity")
|
||||
local public_transport = way.tags:Find("public_transport")
|
||||
if (not highway or highway == '') and
|
||||
if (not highway or highway == '') and
|
||||
(not route or route == '') and
|
||||
(not railway or railway=='') and
|
||||
(not amenity or amenity=='') and
|
||||
(not man_made or man_made=='') and
|
||||
(not public_transport or public_transport=='')
|
||||
then
|
||||
return 0
|
||||
(not public_transport or public_transport=='')
|
||||
then
|
||||
return
|
||||
end
|
||||
|
||||
-- don't route on ways that are still under construction
|
||||
if highway=='construction' then
|
||||
return 0
|
||||
return
|
||||
end
|
||||
|
||||
-- access
|
||||
local access = Access.find_access_tag(way, access_tags_hierachy)
|
||||
if access_tag_blacklist[access] then
|
||||
return 0
|
||||
return
|
||||
end
|
||||
|
||||
local name = way.tags:Find("name")
|
||||
@@ -164,25 +164,31 @@ function way_function (way)
|
||||
if durationIsValid(duration) then
|
||||
way.duration = math.max( 1, parseDuration(duration) )
|
||||
else
|
||||
way.forward_speed = route_speeds[route]
|
||||
way.forward_speed = route_speeds[route]
|
||||
way.backward_speed = route_speeds[route]
|
||||
end
|
||||
way.forward_mode = mode_ferry
|
||||
way.backward_mode = mode_ferry
|
||||
elseif railway and platform_speeds[railway] then
|
||||
-- railway platforms (old tagging scheme)
|
||||
way.forward_speed = platform_speeds[railway]
|
||||
way.backward_speed = platform_speeds[railway]
|
||||
elseif platform_speeds[public_transport] then
|
||||
-- public_transport platforms (new tagging platform)
|
||||
way.forward_speed = platform_speeds[public_transport]
|
||||
way.backward_speed = platform_speeds[public_transport]
|
||||
elseif amenity and amenity_speeds[amenity] then
|
||||
-- parking areas
|
||||
way.forward_speed = amenity_speeds[amenity]
|
||||
way.backward_speed = amenity_speeds[amenity]
|
||||
elseif speeds[highway] then
|
||||
-- regular ways
|
||||
way.forward_speed = speeds[highway]
|
||||
way.forward_speed = speeds[highway]
|
||||
way.backward_speed = speeds[highway]
|
||||
elseif access and access_tag_whitelist[access] then
|
||||
-- unknown way, but valid access tag
|
||||
way.forward_speed = walking_speed
|
||||
way.backward_speed = walking_speed
|
||||
end
|
||||
|
||||
-- oneway
|
||||
@@ -202,6 +208,4 @@ function way_function (way)
|
||||
way.backward_speed = math.min(way.backward_speed, surface_speed)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user