diff --git a/Extractor/ExtractorCallbacks.cpp b/Extractor/ExtractorCallbacks.cpp index 33268a346..c2cc693c3 100644 --- a/Extractor/ExtractorCallbacks.cpp +++ b/Extractor/ExtractorCallbacks.cpp @@ -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; } diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 4c0c581c4..4f567edc9 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -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) diff --git a/profiles/car.lua b/profiles/car.lua index eead81b89..0252b921c 100755 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -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 diff --git a/profiles/foot.lua b/profiles/foot.lua index 130d297a6..1e7cd4ba0 100644 --- a/profiles/foot.lua +++ b/profiles/foot.lua @@ -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 diff --git a/profiles/testbot.lua b/profiles/testbot.lua index a03ea41e3..a0b06f56d 100644 --- a/profiles/testbot.lua +++ b/profiles/testbot.lua @@ -118,6 +118,4 @@ function way_function (way) if junction == 'roundabout' then way.roundabout = true end - - return true end