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
|
# 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
|
# 5.15.0
|
||||||
- Changes from 5.14.3:
|
- Changes from 5.14.3:
|
||||||
|
@ -131,3 +131,57 @@ Feature: Car - Destination only, no passing through
|
|||||||
| e | a | acbe,acbe |
|
| e | a | acbe,acbe |
|
||||||
| d | a | de,acbe,acbe |
|
| d | a | de,acbe,acbe |
|
||||||
| c | d | cd,cd |
|
| 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 { },
|
restricted_highway_whitelist = Set { },
|
||||||
|
|
||||||
|
-- tags disallow access to in combination with highway=service
|
||||||
|
service_access_tag_blacklist = Set { },
|
||||||
|
|
||||||
construction_whitelist = Set {
|
construction_whitelist = Set {
|
||||||
'no',
|
'no',
|
||||||
'widening',
|
'widening',
|
||||||
|
@ -38,8 +38,8 @@ function setup()
|
|||||||
cardinal_directions = false,
|
cardinal_directions = false,
|
||||||
|
|
||||||
-- Size of the vehicle, to be limited by physical restriction of the way
|
-- 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_height = 2.5, -- in meters, 2.5m is the height of van
|
||||||
vehicle_width = 1.9, -- in metters, ways with narrow tag are considered narrower than 2.2m
|
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
|
-- a list of suffixes to suppress in name change instructions. The suffixes also include common substrings of each other
|
||||||
suffix_list = {
|
suffix_list = {
|
||||||
@ -79,6 +79,11 @@ function setup()
|
|||||||
'destination'
|
'destination'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- tags disallow access to in combination with highway=service
|
||||||
|
service_access_tag_blacklist = Set {
|
||||||
|
'private'
|
||||||
|
},
|
||||||
|
|
||||||
restricted_access_tag_list = Set {
|
restricted_access_tag_list = Set {
|
||||||
'private',
|
'private',
|
||||||
'delivery',
|
'delivery',
|
||||||
@ -166,7 +171,8 @@ function setup()
|
|||||||
'tertiary_link',
|
'tertiary_link',
|
||||||
'residential',
|
'residential',
|
||||||
'living_street',
|
'living_street',
|
||||||
'unclassified'
|
'unclassified',
|
||||||
|
'service'
|
||||||
},
|
},
|
||||||
|
|
||||||
construction_whitelist = Set {
|
construction_whitelist = Set {
|
||||||
|
@ -65,6 +65,9 @@ function setup()
|
|||||||
'access'
|
'access'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- tags disallow access to in combination with highway=service
|
||||||
|
service_access_tag_blacklist = Set { },
|
||||||
|
|
||||||
restrictions = Sequence {
|
restrictions = Sequence {
|
||||||
'foot'
|
'foot'
|
||||||
},
|
},
|
||||||
|
@ -81,6 +81,13 @@ function WayHandlers.startpoint(profile,way,result,data)
|
|||||||
result.is_startpoint = result.forward_mode == profile.default_mode or
|
result.is_startpoint = result.forward_mode == profile.default_mode or
|
||||||
result.backward_mode == profile.default_mode
|
result.backward_mode == profile.default_mode
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
-- handle turn lanes
|
-- handle turn lanes
|
||||||
@ -219,7 +226,7 @@ function WayHandlers.access(profile,way,result,data)
|
|||||||
data.forward_access, data.backward_access =
|
data.forward_access, data.backward_access =
|
||||||
Tags.get_forward_backward_by_set(way,data,profile.access_tags_hierarchy)
|
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_highway_whitelist[data.highway] then
|
||||||
if profile.restricted_access_tag_list[data.forward_access] then
|
if profile.restricted_access_tag_list[data.forward_access] then
|
||||||
result.forward_restricted = true
|
result.forward_restricted = true
|
||||||
@ -230,6 +237,7 @@ function WayHandlers.access(profile,way,result,data)
|
|||||||
end
|
end
|
||||||
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
|
if profile.access_tag_blacklist[data.forward_access] and not result.forward_restricted then
|
||||||
result.forward_mode = mode.inaccessible
|
result.forward_mode = mode.inaccessible
|
||||||
end
|
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.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
|
// Test files generated by the routing engine; check test/data
|
||||||
if (process.env.OSRM_DATA_PATH !== undefined) {
|
if (process.env.OSRM_DATA_PATH !== undefined) {
|
||||||
|
@ -69,13 +69,13 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture)
|
|||||||
json::Object{{
|
json::Object{{
|
||||||
{"location", location},
|
{"location", location},
|
||||||
{"bearing_before", 0},
|
{"bearing_before", 0},
|
||||||
{"bearing_after", 58},
|
{"bearing_after", 238},
|
||||||
{"type", "depart"},
|
{"type", "depart"},
|
||||||
}}},
|
}}},
|
||||||
{"intersections",
|
{"intersections",
|
||||||
json::Array{{json::Object{
|
json::Array{{json::Object{
|
||||||
{{"location", location},
|
{{"location", location},
|
||||||
{"bearings", json::Array{{58}}},
|
{"bearings", json::Array{{238}}},
|
||||||
{"entry", json::Array{{json::True()}}},
|
{"entry", json::Array{{json::True()}}},
|
||||||
{"out", 0}}}}}}}}},
|
{"out", 0}}}}}}}}},
|
||||||
|
|
||||||
@ -88,13 +88,13 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture)
|
|||||||
{"driving_side", "right"},
|
{"driving_side", "right"},
|
||||||
{"maneuver",
|
{"maneuver",
|
||||||
json::Object{{{"location", location},
|
json::Object{{{"location", location},
|
||||||
{"bearing_before", 58},
|
{"bearing_before", 238},
|
||||||
{"bearing_after", 0},
|
{"bearing_after", 0},
|
||||||
{"type", "arrive"}}}},
|
{"type", "arrive"}}}},
|
||||||
{"intersections",
|
{"intersections",
|
||||||
json::Array{{json::Object{
|
json::Array{{json::Object{
|
||||||
{{"location", location},
|
{{"location", location},
|
||||||
{"bearings", json::Array{{238}}},
|
{"bearings", json::Array{{58}}},
|
||||||
{"entry", json::Array{{json::True()}}},
|
{"entry", json::Array{{json::True()}}},
|
||||||
{"in", 0}}}}}}
|
{"in", 0}}}}}}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user