more robust check for parsed ways
This commit is contained in:
parent
bb3cbf2dda
commit
774e6346e7
@ -63,7 +63,11 @@ bool ExtractorCallbacks::ProcessRestriction(const InputRestrictionContainer &res
|
||||
/** warning: caller needs to take care of synchronization! */
|
||||
void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
|
||||
{
|
||||
if ((0 >= parsed_way.forward_speed) && (0 >= parsed_way.duration))
|
||||
if (((0 >= parsed_way.forward_speed) ||
|
||||
(TRAVEL_MODE_INACCESSIBLE == parsed_way.forward_travel_mode)) &&
|
||||
((0 >= parsed_way.backward_speed) ||
|
||||
(TRAVEL_MODE_INACCESSIBLE == parsed_way.backward_travel_mode)) &&
|
||||
(0 >= parsed_way.duration))
|
||||
{ // Only true if the way is specified by the speed profile
|
||||
return;
|
||||
}
|
||||
|
@ -168,18 +168,18 @@ function way_function (way)
|
||||
(not man_made or man_made=='') and
|
||||
(not public_transport or public_transport=='')
|
||||
then
|
||||
return 0
|
||||
return
|
||||
end
|
||||
|
||||
-- don't route on ways or railways that are still under construction
|
||||
if highway=='construction' or railway=='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
|
||||
|
||||
-- other tags
|
||||
@ -267,15 +267,18 @@ function way_function (way)
|
||||
if pedestrian_speeds[highway] then
|
||||
-- pedestrian-only ways and areas
|
||||
way.forward_speed = pedestrian_speeds[highway]
|
||||
way.backward_speed = pedestrian_speeds[highway]
|
||||
way.forward_mode = mode_pushing
|
||||
way.backward_mode = mode_pushing
|
||||
elseif man_made and man_made_speeds[man_made] then
|
||||
-- man made structures
|
||||
way.forward_speed = man_made_speeds[man_made]
|
||||
way.backward_speed = man_made_speeds[man_made]
|
||||
way.forward_mode = mode_pushing
|
||||
way.backward_mode = mode_pushing
|
||||
elseif foot == 'yes' then
|
||||
way.forward_speed = walking_speed
|
||||
way.backward_speed = walking_speed
|
||||
way.forward_mode = mode_pushing
|
||||
way.backward_mode = mode_pushing
|
||||
elseif foot_forward == 'yes' then
|
||||
@ -308,6 +311,7 @@ function way_function (way)
|
||||
if impliedOneway then
|
||||
way.forward_mode = 0
|
||||
way.backward_mode = mode_normal
|
||||
way.backward_speed = bicycle_speeds["cycleway"]
|
||||
end
|
||||
elseif cycleway_left and cycleway_tags[cycleway_left] and cycleway_right and cycleway_tags[cycleway_right] then
|
||||
-- prevent implied
|
||||
@ -315,10 +319,12 @@ function way_function (way)
|
||||
if impliedOneway then
|
||||
way.forward_mode = 0
|
||||
way.backward_mode = mode_normal
|
||||
way.backward_speed = bicycle_speeds["cycleway"]
|
||||
end
|
||||
elseif cycleway_right and cycleway_tags[cycleway_right] then
|
||||
if impliedOneway then
|
||||
way.forward_mode = mode_normal
|
||||
way.backward_speed = bicycle_speeds["cycleway"]
|
||||
way.backward_mode = 0
|
||||
end
|
||||
elseif oneway == "-1" then
|
||||
@ -372,8 +378,6 @@ function way_function (way)
|
||||
|
||||
-- maxspeed
|
||||
MaxSpeed.limit( way, maxspeed, maxspeed_forward, maxspeed_backward )
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function turn_function (angle)
|
||||
|
@ -192,23 +192,27 @@ function way_function (way)
|
||||
if highway_speed then
|
||||
if max_speed > highway_speed then
|
||||
way.forward_speed = max_speed
|
||||
way.backward_speed = max_speed
|
||||
-- max_speed = math.huge
|
||||
else
|
||||
way.forward_speed = highway_speed
|
||||
way.backward_speed = highway_speed
|
||||
end
|
||||
else
|
||||
-- Set the avg speed on ways that are marked accessible
|
||||
if access_tag_whitelist[access] then
|
||||
way.forward_speed = speed_profile["default"]
|
||||
way.backward_speed = speed_profile["default"]
|
||||
end
|
||||
end
|
||||
if 0 == max_speed then
|
||||
max_speed = math.huge
|
||||
end
|
||||
way.forward_speed = min(way.forward_speed, max_speed)
|
||||
way.backward_speed = min(way.backward_speed, max_speed)
|
||||
end
|
||||
|
||||
if -1 == way.forward_speed then
|
||||
if -1 == way.forward_speed and -1 == way.backward_speed then
|
||||
return
|
||||
end
|
||||
|
||||
@ -280,7 +284,6 @@ function way_function (way)
|
||||
if maxspeed_backward > 0 then
|
||||
way.backward_speed = way.backward_speed*speed_reduction
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- These are wrappers to parse vectors of nodes and ways and thus to speed up any tracing JIT
|
||||
|
@ -116,18 +116,18 @@ function way_function (way)
|
||||
(not man_made or man_made=='') and
|
||||
(not public_transport or public_transport=='')
|
||||
then
|
||||
return 0
|
||||
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")
|
||||
@ -165,24 +165,30 @@ function way_function (way)
|
||||
way.duration = math.max( 1, parseDuration(duration) )
|
||||
else
|
||||
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.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
|
||||
|
@ -118,6 +118,4 @@ function way_function (way)
|
||||
if junction == 'roundabout' then
|
||||
way.roundabout = true
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user