Allow restricted access on highway=service roads for the car profile
We still backlist `access=private` for the car profile though.
This commit is contained in:
parent
a9d94d35a2
commit
02712cd513
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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',
|
||||
|
@ -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 {
|
||||
|
@ -65,6 +65,9 @@ function setup()
|
||||
'access'
|
||||
},
|
||||
|
||||
-- tags disallow access to in combination with highway=service
|
||||
service_access_tag_blacklist = Set { },
|
||||
|
||||
restrictions = Sequence {
|
||||
'foot'
|
||||
},
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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}}}}}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user