support junction = circular in all profiles, add additional tests
References: - https://wiki.openstreetmap.org/wiki/Tag:junction%3Dcircular - https://lists.openstreetmap.org/pipermail/tagging/2016-November/030520.html - https://github.com/Project-OSRM/osrm-backend/issues/3361
This commit is contained in:
parent
12d58ace10
commit
fe5cc55b0e
@ -492,3 +492,46 @@ Feature: Basic Roundabout
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| e,h | left,right,right | depart,roundabout-exit-2,arrive |
|
||||
|
||||
@3361
|
||||
Scenario: Bersarinplatz (Not a Roundabout)
|
||||
Given the node map
|
||||
"""
|
||||
a n
|
||||
|
||||
b m
|
||||
|
||||
c l
|
||||
|
||||
d e j k
|
||||
|
||||
f h
|
||||
|
||||
g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | junction | name | ref | highway | oneway |
|
||||
| ab | | Petersburger Strasse | B 96a | primary | yes |
|
||||
| bc | circular | Bersarinplatz | B 96a | primary | |
|
||||
| ce | circular | Bersarinplatz | B 96a | primary | |
|
||||
| ed | | Weidenweg | | residential | |
|
||||
| ef | circular | Bersarinplatz | B 96a | primary | |
|
||||
| fg | | Petersburger Strasse | B 96a | primary | yes |
|
||||
| fh | circular | Bersarinplatz | | secondary | |
|
||||
| ih | | Petersburger Strasse | B 96a | primary | yes |
|
||||
| hj | circular | Bersarinplatz | | secondary | |
|
||||
| jk | | Rigaer Strasse | | residential | |
|
||||
| jl | circular | Bersarinplatz | | secondary | |
|
||||
| lm | circular | Bersarinplatz | | secondary | |
|
||||
| mb | circular | Bersarinplatz | | secondary | |
|
||||
| mn | | Petersburger Strasse | B 96a | primary | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,g | Petersburger Strasse,Petersburger Strasse,Petersburger Strasse | depart,Bersarinplatz-exit-2,arrive |
|
||||
| d,g | Weidenweg,Petersburger Strasse,Petersburger Strasse | depart,Bersarinplatz-exit-1,arrive |
|
||||
| i,k | Petersburger Strasse,Rigaer Strasse,Rigaer Strasse | depart,Bersarinplatz-exit-1,arrive |
|
||||
| i,n | Petersburger Strasse,Petersburger Strasse,Petersburger Strasse | depart,Bersarinplatz-exit-2,arrive |
|
||||
| i,d | Petersburger Strasse,Weidenweg,Weidenweg | depart,Bersarinplatz-exit-3,arrive |
|
||||
| i,g | Petersburger Strasse,Petersburger Strasse,Petersburger Strasse | depart,Bersarinplatz-exit-4,arrive |
|
||||
|
@ -221,9 +221,12 @@ function way_function (way, result)
|
||||
end
|
||||
|
||||
-- roundabout handling
|
||||
if junction and "roundabout" == junction then
|
||||
if junction and ("roundabout" == junction) then
|
||||
result.roundabout = true
|
||||
end
|
||||
if junction and ("circular" == junction) then
|
||||
result.circular = true;
|
||||
end
|
||||
|
||||
-- speed
|
||||
local bridge_speed = bridge_speeds[bridge]
|
||||
@ -281,7 +284,7 @@ function way_function (way, result)
|
||||
else
|
||||
-- biking not allowed, maybe we can push our bike?
|
||||
-- essentially requires pedestrian profiling, for example foot=no mean we can't push a bike
|
||||
if foot ~= 'no' and junction ~= "roundabout" then
|
||||
if foot ~= 'no' and (junction ~= "roundabout" and junction ~= "circular") then
|
||||
if pedestrian_speeds[highway] then
|
||||
-- pedestrian-only ways and areas
|
||||
result.forward_speed = pedestrian_speeds[highway]
|
||||
@ -313,7 +316,7 @@ function way_function (way, result)
|
||||
|
||||
-- direction
|
||||
local impliedOneway = false
|
||||
if junction == "roundabout" or highway == "motorway" then
|
||||
if junction == "roundabout" or junction == "circular" or highway == "motorway" then
|
||||
impliedOneway = true
|
||||
end
|
||||
|
||||
@ -353,7 +356,7 @@ function way_function (way, result)
|
||||
|
||||
-- pushing bikes
|
||||
if bicycle_speeds[highway] or pedestrian_speeds[highway] then
|
||||
if foot ~= "no" and junction ~= "roundabout" then
|
||||
if foot ~= "no" and junction ~= "roundabout" and junction ~= "circular" then
|
||||
if result.backward_mode == mode.inaccessible then
|
||||
result.backward_speed = walking_speed
|
||||
result.backward_mode = mode.pushing_bike
|
||||
|
@ -551,10 +551,16 @@ end
|
||||
|
||||
-- junctions
|
||||
function handle_roundabouts(way,result)
|
||||
if way:get_value_by_key("junction") == "roundabout" then
|
||||
local junction = way:get_value_by_key("junction");
|
||||
|
||||
if junction == "roundabout" then
|
||||
result.roundabout = true
|
||||
end
|
||||
if way:get_value_by_key("junction") == "circular" then
|
||||
|
||||
-- See Issue 3361: roundabout-shaped not following roundabout rules.
|
||||
-- This will get us "At Strausberger Platz do Maneuver X" instead of multiple quick turns.
|
||||
-- In a new API version we can think of having a separate type passing it through to the user.
|
||||
if junction == "circular" then
|
||||
result.circular = true
|
||||
end
|
||||
end
|
||||
|
@ -156,10 +156,13 @@ function way_function (way, result)
|
||||
result.ref = ref
|
||||
end
|
||||
|
||||
-- roundabouts
|
||||
-- roundabouts
|
||||
if "roundabout" == junction then
|
||||
result.roundabout = true
|
||||
end
|
||||
if "circular" == junction then
|
||||
result.circular = true
|
||||
end
|
||||
|
||||
-- speed
|
||||
if route_speeds[route] then
|
||||
|
@ -353,7 +353,8 @@
|
||||
{
|
||||
"key": "junction",
|
||||
"object_types": [ "way" ],
|
||||
"value": "circular"
|
||||
"value": "circular",
|
||||
"description": "A Roundabout where the traffic on the roundabout not always has right of way."
|
||||
},
|
||||
{
|
||||
"key": "type",
|
||||
|
Loading…
Reference in New Issue
Block a user