Fix snapping target locations to ways used in turn restrictions (#6339)
Currently there is an edge-case in the turn restriction implementation, such that routes can not be found if the target input location snaps to a way used in a (multi) via restriction. With the addition of snapping input locations to multiple ways, we can now also snap to the "duplicate" edges created for the restriction graph, thereby fixing the problem. This is achieved by adding the duplicate restriction edges to the geospatial search RTree. This does open up the possibility of multiple paths representing exactly the same route - one using the original edge as a source, the other using the duplicate restriction graph edge as source. This is fine, as both edges are represented by the same geometry, so will generate the same result.
This commit is contained in:
@@ -1031,3 +1031,61 @@ Feature: Car - Multiple Via Turn restrictions
|
||||
| from | to | route | locations |
|
||||
| a | f | ab,bc,cd,de,ef,ef | a,b,c,d,e,f |
|
||||
|
||||
|
||||
@restriction-way
|
||||
Scenario: Snap source/target to via restriction way
|
||||
Given the node map
|
||||
"""
|
||||
a-1-b-2-c-3-d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| cd |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bc | cd | no_straight_on |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| 1 | 2 | ab,bc,bc |
|
||||
| 2 | 3 | bc,cd,cd |
|
||||
|
||||
|
||||
@restriction-way
|
||||
Scenario: Car - Snap source/target to multi-via restriction way
|
||||
# Example: https://www.openstreetmap.org/relation/11787041
|
||||
Given the node map
|
||||
"""
|
||||
|--g---f---e
|
||||
a | 1
|
||||
|--b---c---d
|
||||
|
||||
"""
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | name |
|
||||
| ab | yes | enter |
|
||||
| bc | yes | enter |
|
||||
| cd | yes | right |
|
||||
| de | yes | up |
|
||||
| ef | yes | left |
|
||||
| fc | yes | down |
|
||||
| fg | yes | exit |
|
||||
| ga | yes | exit |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | bc | cd,de,ef | fg | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | locations |
|
||||
| a | 1 | enter,right,up,up | a,c,d,_ |
|
||||
| 1 | a | up,left,exit,exit | _,e,f,a |
|
||||
|
||||
Reference in New Issue
Block a user