diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ad8c9db2..2665836cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # UNRELEASED + - Changes from 5.15.0: + - Profile: + - FIXED: `highway=service` will now be used for restricted access, `access=private` is still disabled for snapping. # 5.15.0 - Changes from 5.14.3: diff --git a/features/car/destination.feature b/features/car/destination.feature index aee592a11..8f9077742 100644 --- a/features/car/destination.feature +++ b/features/car/destination.feature @@ -131,3 +131,57 @@ Feature: Car - Destination only, no passing through | e | a | acbe,acbe | | d | a | de,acbe,acbe | | c | d | cd,cd | + + Scenario: Car - Routing through a parking lot tagged access=destination,service + Given the node map + """ + a----c++++b+++g----h---i + | + + + | + | + + + | + | + + + | + | d++++e+f / + z---------------y + """ + + And the ways + | nodes | access | highway | + | ac | | secondary | + | ghi | | secondary | + | azyhi | | secondary | + | cd | destination | service | + | def | destination | service | + | cbg | destination | service | + | be | destination | service | + | gf | destination | service | + + When I route I should get + | from | to | route | + | a | i | azyhi,azyhi | + | b | f | be,def,def | + + Scenario: Car - Disallow snapping to access=private,highway=service + Given a grid size of 20 meters + Given the node map + """ + a---c---b + : + x + : + d + \__e + """ + + And the ways + | nodes | access | highway | + | acb | | primary | + | cx | private | service | + | xd | private | service | + | de | | primary | + + When I route I should get + | from | to | route | + | a | x | acb,xd,xd | + | a | d | acb,xd,xd | + | a | e | acb,xd,de | + | x | e | de,de | + # do not snap to access=private,highway=service roads when routing over them is not necessary diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index b3e11651d..4014b02b0 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -71,6 +71,9 @@ function setup() restricted_highway_whitelist = Set { }, + -- tags disallow access to in combination with highway=service + service_access_tag_blacklist = Set { }, + construction_whitelist = Set { 'no', 'widening', diff --git a/profiles/car.lua b/profiles/car.lua index 04d24eba6..c58a16120 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -38,8 +38,8 @@ function setup() cardinal_directions = false, -- Size of the vehicle, to be limited by physical restriction of the way - vehicle_height = 2.5, -- in metters, 2.5m is the height of van - vehicle_width = 1.9, -- in metters, ways with narrow tag are considered narrower than 2.2m + vehicle_height = 2.5, -- in meters, 2.5m is the height of van + vehicle_width = 1.9, -- in meters, ways with narrow tag are considered narrower than 2.2m -- a list of suffixes to suppress in name change instructions. The suffixes also include common substrings of each other suffix_list = { @@ -79,6 +79,11 @@ function setup() 'destination' }, + -- tags disallow access to in combination with highway=service + service_access_tag_blacklist = Set { + 'private' + }, + restricted_access_tag_list = Set { 'private', 'delivery', @@ -166,7 +171,8 @@ function setup() 'tertiary_link', 'residential', 'living_street', - 'unclassified' + 'unclassified', + 'service' }, construction_whitelist = Set { diff --git a/profiles/foot.lua b/profiles/foot.lua index 809e18ef1..f0527337b 100644 --- a/profiles/foot.lua +++ b/profiles/foot.lua @@ -65,6 +65,9 @@ function setup() 'access' }, + -- tags disallow access to in combination with highway=service + service_access_tag_blacklist = Set { }, + restrictions = Sequence { 'foot' }, diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index 99fcf6d11..58d25f110 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -81,6 +81,13 @@ function WayHandlers.startpoint(profile,way,result,data) result.is_startpoint = result.forward_mode == profile.default_mode or result.backward_mode == profile.default_mode end + -- highway=service and access tags check + local is_service = data.highway == "service" + if is_service then + if profile.service_access_tag_blacklist[data.forward_access] then + result.is_startpoint = false + end + end end -- handle turn lanes @@ -219,7 +226,7 @@ function WayHandlers.access(profile,way,result,data) data.forward_access, data.backward_access = Tags.get_forward_backward_by_set(way,data,profile.access_tags_hierarchy) - -- only allow a subset of roads that are marked as restricted + -- only allow a subset of roads to be treated as restricted if profile.restricted_highway_whitelist[data.highway] then if profile.restricted_access_tag_list[data.forward_access] then result.forward_restricted = true @@ -230,6 +237,7 @@ function WayHandlers.access(profile,way,result,data) end end + -- blacklist access tags that aren't marked as restricted if profile.access_tag_blacklist[data.forward_access] and not result.forward_restricted then result.forward_mode = mode.inaccessible end diff --git a/test/nodejs/constants.js b/test/nodejs/constants.js index 796009ee7..451fb73ea 100644 --- a/test/nodejs/constants.js +++ b/test/nodejs/constants.js @@ -10,8 +10,7 @@ exports.three_test_coordinates = [[7.41337, 43.72956], exports.two_test_coordinates = exports.three_test_coordinates.slice(0, 2) -exports.test_tile = {'at': [17059, 11948, 15], 'size': 169239}; - +exports.test_tile = {'at': [17059, 11948, 15], 'size': 169387}; // Test files generated by the routing engine; check test/data if (process.env.OSRM_DATA_PATH !== undefined) { diff --git a/unit_tests/library/route.cpp b/unit_tests/library/route.cpp index 01d86326f..357cef710 100644 --- a/unit_tests/library/route.cpp +++ b/unit_tests/library/route.cpp @@ -69,13 +69,13 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture) json::Object{{ {"location", location}, {"bearing_before", 0}, - {"bearing_after", 58}, + {"bearing_after", 238}, {"type", "depart"}, }}}, {"intersections", json::Array{{json::Object{ {{"location", location}, - {"bearings", json::Array{{58}}}, + {"bearings", json::Array{{238}}}, {"entry", json::Array{{json::True()}}}, {"out", 0}}}}}}}}}, @@ -88,13 +88,13 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture) {"driving_side", "right"}, {"maneuver", json::Object{{{"location", location}, - {"bearing_before", 58}, + {"bearing_before", 238}, {"bearing_after", 0}, {"type", "arrive"}}}}, {"intersections", json::Array{{json::Object{ {{"location", location}, - {"bearings", json::Array{{238}}}, + {"bearings", json::Array{{58}}}, {"entry", json::Array{{json::True()}}}, {"in", 0}}}}}}