Fix routing when start and target are on the same segment

Fixes issue #1864. Given the simple set-up:

a --> b --> c
^-----------|

This would translate into an edge based graph (ab) -> (bc),
(bc) -> (ca), (ca) -> (ab).

Starting at the end of the one-way street (ab) and going to
the beginning, the query has to find a self-loop within the
graph (ab) -> (bc) -> (ca) -> (ab), as both nodes map to the
same segment (ab).
This commit is contained in:
Moritz Kobitzsch
2016-01-07 10:33:47 +01:00
committed by Patrick Niklaus
parent 238e77d959
commit 1c1bfd7541
22 changed files with 744 additions and 287 deletions
+23 -5
View File
@@ -29,7 +29,7 @@ Feature: Basic Distance Matrix
| ab | primary |
| bc | secondary |
| cd | tertiary |
When I request a travel time matrix I should get
| | a | b | c | d |
| a | 0 | 100 | 300 | 600 |
@@ -49,7 +49,7 @@ Feature: Basic Distance Matrix
| | a | b |
| a | 0 | 95 +- 10 |
| b | 95 ~10% | 0 |
Scenario: Testbot - Travel time matrix of small grid
Given the node map
| a | b | c |
@@ -82,7 +82,7 @@ Feature: Basic Distance Matrix
| | a | b |
| a | 0 | 100 |
| b | | 0 |
Scenario: Testbot - Travel time matrix of network with oneways
Given the node map
| x | a | b | y |
@@ -136,7 +136,7 @@ Feature: Basic Distance Matrix
| a | 100 | 200 | 300 |
| b | 0 | 100 | 200 |
Scenario: Testbog - All coordinates are from same small component
Scenario: Testbot - All coordinates are from same small component
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the node map
@@ -156,7 +156,7 @@ Feature: Basic Distance Matrix
| f | 0 | 300 |
| g | 300 | 0 |
Scenario: Testbog - Coordinates are from different small component and snap to big CC
Scenario: Testbot - Coordinates are from different small component and snap to big CC
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the node map
@@ -179,3 +179,21 @@ Feature: Basic Distance Matrix
| h | 0 | 300 | 0 | 300 |
| i | 300 | 0 | 300 | 0 |
Scenario: Testbot - Travel time matrix with loops
Given the node map
| a | 1 | 2 | b |
| d | 4 | 3 | c |
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
| cd | yes |
| da | yes |
When I request a travel time matrix I should get
| | 1 | 2 | 3 | 4 |
| 1 | 0 | 100 +-1 | 400 +-1 | 500 +-1 |
| 2 | 700 +-1 | 0 | 300 +-1 | 400 +-1 |
| 3 | 400 +-1 | 500 +-1 | 0 | 100 +-1 |
| 4 | 300 +-1 | 400 +-1 | 700 +-1 | 0 |
+42 -3
View File
@@ -93,8 +93,6 @@ Feature: Via points
| 1,3,2 | ab,bc,cd,cd,de,ef,fa,ab,bc | 1600m +-1 | head,straight,straight,via,right,right,right,right,straight,destination |
| 3,2,1 | cd,de,ef,fa,ab,bc,bc,cd,de,ef,fa,ab | 2400m +-1 | head,right,right,right,right,straight,via,straight,right,right,right,right,destination |
# TODO: Remove this ignore when https://github.com/Project-OSRM/osrm-backend/issues/1863 gets fixed
@ignore-platform-mac
Scenario: Via points on ring on the same oneway
# xa it to avoid only having a single ring, which cna trigger edge cases
Given the node map
@@ -118,7 +116,6 @@ Feature: Via points
| 1,3,2 | ab,ab,bc,cd,da,ab | 1100m +-1 | head,via,right,right,right,right,destination |
| 3,2,1 | ab,bc,cd,da,ab,ab,bc,cd,da,ab | 1800m | head,right,right,right,right,via,right,right,right,right,destination |
# See issue #1896
Scenario: Via point at a dead end with oneway
Given the node map
@@ -162,3 +159,45 @@ Feature: Via points
| waypoints | route |
| a,1,c | abc,bd,bd,bd,abc |
| c,1,a | abc,bd,bd,bd,abc |
Scenario: Via points on ring on the same oneway, forces one of the vertices to be top node
Given the node map
| a | 1 | 2 | b |
| 8 | | | 3 |
| 7 | | | 4 |
| d | 6 | 5 | c |
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
| cd | yes |
| da | yes |
When I route I should get
| waypoints | route | distance | turns |
| 2,1 | ab,bc,cd,da,ab | 1100m +-1 | head,right,right,right,right,destination |
| 4,3 | bc,cd,da,ab,bc | 1100m +-1 | head,right,right,right,right,destination |
| 6,5 | cd,da,ab,bc,cd | 1100m +-1 | head,right,right,right,right,destination |
| 8,7 | da,ab,bc,cd,da | 1100m +-1 | head,right,right,right,right,destination |
Scenario: Multiple Via points on ring on the same oneway, forces one of the vertices to be top node
Given the node map
| a | 1 | 2 | 3 | b |
| | | | | 4 |
| | | | | 5 |
| | | | | 6 |
| d | 9 | 8 | 7 | c |
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
| cd | yes |
| da | yes |
When I route I should get
| waypoints | route | distance | turns |
| 3,2,1 | ab,bc,cd,da,ab,ab,bc,cd,da,ab | 3000m +-1 | head,right,right,right,right,via,right,right,right,right,destination |
| 6,5,4 | bc,cd,da,ab,bc,bc,cd,da,ab,bc | 3000m +-1 | head,right,right,right,right,via,right,right,right,right,destination |
| 9,8,7 | cd,da,ab,bc,cd,cd,da,ab,bc,cd | 3000m +-1 | head,right,right,right,right,via,right,right,right,right,destination |