Skip to content

Commit 2e38d3c

Browse files
dgearhartkarenzshea
authored andcommitted
Do not combine a segregated edge with a roundabout (#5040)
* Do not combine a segregated edge with a roundabout, add test
1 parent 020c0d1 commit 2e38d3c

File tree

4 files changed

+113
-5
lines changed

4 files changed

+113
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 5.17.1
2+
- Changes from 5.17.0:
3+
- Bugfixes:
4+
- FIXED: Do not combine a segregated edge with a roundabout [#5039](https://github.com/Project-OSRM/osrm-backend/issues/5039)
5+
16
# 5.17.0
27
- Changes from 5.16.0:
38
- Bugfixes:

features/testbot/fixed.feature

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,64 @@ Feature: Fixed bugs, kept to check for regressions
3939
| de | yes |
4040

4141
When I route I should get
42-
| from | to | route |
43-
| 1 | 2 | bcd,bcd |
42+
| from | to | route |
43+
| 1 | 2 | bcd,bcd |
44+
45+
#############################
46+
# This test models the OSM map at the location for
47+
# https://github.com/Project-OSRM/osrm-backend/issues/5039
48+
#############################
49+
Scenario: Mixed Entry and Exit and segregated
50+
Given the profile file "car" initialized with
51+
"""
52+
profile.properties.left_hand_driving = true
53+
"""
54+
Given the node locations
55+
| node | lon | lat |
56+
| a | 171.12889297029 | -42.58425289548 |
57+
| b | 171.1299357 | -42.5849295 |
58+
| c | 171.1295427 | -42.5849385 |
59+
| d | 171.1297356 | -42.5852029 |
60+
| e | 171.1296909 | -42.5851986 |
61+
| f | 171.1295097 | -42.585007 |
62+
| g | 171.1298225 | -42.5851928 |
63+
| h | 171.1300262 | -42.5859122 |
64+
| i | 171.1292651 | -42.584698 |
65+
| j | 171.1297209 | -42.5848569 |
66+
| k | 171.1297188 | -42.5854056 |
67+
| l | 171.1298326 | -42.5857266 |
68+
| m | 171.1298871 | -42.5848922 |
69+
| n | 171.1296505 | -42.585189 |
70+
| o | 171.1295206 | -42.5850862 |
71+
| p | 171.1296106 | -42.5848862 |
72+
| q | 171.1299784 | -42.5850191 |
73+
| r | 171.1298867 | -42.5851671 |
74+
| s | 171.1306955 | -42.5845812 |
75+
| t | 171.129525 | -42.584807 |
76+
| u | 171.1299705 | -42.584984 |
77+
| v | 171.1299067 | -42.5849073 |
78+
| w | 171.1302061 | -42.5848173 |
79+
| x | 171.12975 | -42.5855753 |
80+
| y | 171.129969 | -42.585079 |
81+
| 1 | 171.131511926651| -42.584306746421966 |
82+
| 2 | 171.128743886947| -42.58414875714669 |
83+
And the ways
84+
| nodes | highway | maxspeed | name | ref | surface | junction | oneway |
85+
| ws | primary | 100 | Taramakau Highway | SH 6 | asphalt | | |
86+
| kxlh | trunk | | Otira Highway | SH 73 | | | |
87+
| ai | primary | 100 | Kumara Junction Highway | SH 6 | asphalt | | |
88+
| qyrgdenof | primary | 100 | Kumara Junction | | | roundabout | yes |
89+
| ke | trunk | | Otira Highway | SH 73 | | | yes |
90+
| itj | primary | 100 | Kumara Junction Highway | SH 6 | | | yes |
91+
| gk | trunk | | Otira Highway | SH 73 | | | yes |
92+
| fi | primary | 100 | Kumara Junction Highway | SH 6 | | | yes |
93+
| wq | primary | 100 | Taramakau Highway | SH 6 | | | yes |
94+
| vw | primary | 100 | Taramakau Highway | SH 6 | | | yes |
95+
| vbuq | primary | 100 | Kumara Junction | | | roundabout | yes |
96+
| jmv | primary | 100 | Kumara Junction | | | roundabout | yes |
97+
| fcpj | primary | 100 | Kumara Junction | | | roundabout | yes |
98+
99+
When I route I should get
100+
| waypoints | route | turns |
101+
| 1,2 | Taramakau Highway,Kumara Junction Highway,Kumara Junction Highway,Kumara Junction Highway | depart,Kumara Junction-exit-2,exit rotary slight left,arrive |
102+

scripts/osm2cucumber.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*********************************
2+
* Takes an XML `.osm` file and converts it into a cucumber scenario definition like
3+
* Given the node locations
4+
* | node | lon | lat |
5+
* .....
6+
* Given the ways
7+
* | nodes | tag1 | tag2 | tag3 |
8+
* .....
9+
*
10+
* Note that cucumber tests are limited to 26 nodes (labelled a-z), so
11+
* you'll need to use pretty small OSM extracts to get this to work.
12+
*****************************************/
13+
var fs = require('fs');
14+
var parseString = require('xml2js').parseString;
15+
16+
var data = fs.readFileSync('filename.osm', 'utf8');
17+
18+
const items = parseString(data, (err, result) => {
19+
var idmap = {};
20+
21+
console.log('Given the node locations');
22+
console.log(' | node | lon | lat |');
23+
result.osm.node.filter(n => !n.$.action || n.$.action !== 'delete').forEach(i => {
24+
var code = String.fromCharCode(97 + Object.keys(idmap).length)
25+
idmap[i.$.id] = code;
26+
console.log(` | ${code} | ${i.$.lon} | ${i.$.lat} |`);
27+
});
28+
29+
var allkeys = {};
30+
var waytags = {};
31+
32+
result.osm.way.filter(n => !n.$.action || n.$.action !== 'delete').forEach(w => {
33+
if (!waytags[w.$.id]) waytags[w.$.id] = {};
34+
w.tag.forEach(t => { allkeys[t.$.k] = t.$.v; waytags[w.$.id][t.$.k] = t.$.v; });
35+
});
36+
37+
console.log('And the ways');
38+
console.log(` | nodes | ${Object.keys(allkeys).join(' | ')} |`);
39+
40+
result.osm.way.filter(n => !n.$.action || n.$.action !== 'delete').forEach(w => {
41+
console.log(` | ${w.nd.map(n => idmap[n.$.ref]).join('')} | ${Object.keys(allkeys).map(k => waytags[w.$.id][k] || '').join(' | ')} |`);
42+
});
43+
});

src/engine/guidance/collapse_turns.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,10 @@ RouteSteps collapseSegregatedTurnInstructions(RouteSteps steps)
618618
TransferLanesStrategy());
619619
++next_step;
620620
}
621-
// else if the current step is segregated and the next step is not then combine with turn
622-
// adjustment
623-
else if (curr_step->is_segregated && !next_step->is_segregated)
621+
// else if the current step is segregated and the next step is not segregated
622+
// and the next step is not a roundabout then combine with turn adjustment
623+
else if (curr_step->is_segregated && !next_step->is_segregated &&
624+
!hasRoundaboutType(next_step->maneuver.instruction))
624625
{
625626
// Determine if u-turn
626627
if (bearingsAreReversed(

0 commit comments

Comments
 (0)