Skip to content

Commit f5120d1

Browse files
Karen Sheadanpat
authored andcommitted
Remove deduplication of unpacked_path_segments in MM collapsing (#4911)
1 parent d30d28c commit f5120d1

File tree

6 files changed

+74
-11
lines changed

6 files changed

+74
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 5.16.1
2+
- Changes from 5.16.0:
3+
- Bugfixes
4+
- FIXED #4909: deduplication of route steps when waypoints are used [#4909](https://github.com/Project-OSRM/osrm-backend/issues/4909)
15

26
# 5.16.0
37
- Changes from 5.15.2:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ endif()
6161
project(OSRM C CXX)
6262
set(OSRM_VERSION_MAJOR 5)
6363
set(OSRM_VERSION_MINOR 16)
64-
set(OSRM_VERSION_PATCH 0)
64+
set(OSRM_VERSION_PATCH 1)
6565
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
6666

6767
add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")

features/testbot/matching.feature

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,3 +626,61 @@ Feature: Basic Map Matching
626626
| trace | timestamps | matchings | code |
627627
| abbecd | 10 11 27 1516914902 1516914913 1516914952 | ab,ecd | Ok |
628628

629+
Scenario: Regression test - waypoints trimming too much geometry
630+
# fixes bug in map matching collapsing that was dropping path geometries
631+
# after segments that had 0 distance in internal route results
632+
Given the node map
633+
"""
634+
ad
635+
|
636+
|
637+
|
638+
|
639+
|e g
640+
b--------------c
641+
f h
642+
"""
643+
644+
And the ways
645+
| nodes |
646+
| ab |
647+
| bc |
648+
649+
Given the query options
650+
| waypoints | 0;4 |
651+
| overview | full |
652+
653+
When I match I should get
654+
| trace | geometry | code |
655+
| defgh | 1,1,1,0.999461,1.000674,0.999461 | Ok |
656+
657+
@match @testbot
658+
Scenario: Regression test - waypoints trimming too much geometry
659+
Given the profile "testbot"
660+
Given a grid size of 10 meters
661+
Given the query options
662+
| geometries | geojson |
663+
Given the node map
664+
"""
665+
bh
666+
|
667+
|
668+
|
669+
c
670+
g\
671+
\k
672+
\
673+
\
674+
\
675+
j f
676+
"""
677+
And the ways
678+
| nodes |
679+
| hc |
680+
| cf |
681+
Given the query options
682+
| waypoints | 0;3 |
683+
| overview | full |
684+
When I match I should get
685+
| trace | geometry | code |
686+
| bgkj | 1.000135,1,1.000135,0.99964,1.000387,0.999137 | Ok |

include/engine/internal_route_result.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ inline InternalRouteResult CollapseInternalRouteResult(const InternalRouteResult
139139
{
140140
BOOST_ASSERT(!collapsed.unpacked_path_segments.empty());
141141
auto &last_segment = collapsed.unpacked_path_segments.back();
142-
// deduplicate last segment (needs to be checked for empty for the same node query edge
143-
// case)
144-
if (!last_segment.empty())
145-
last_segment.pop_back();
146-
// update target phantom node of leg
147142
BOOST_ASSERT(!collapsed.segment_end_coordinates.empty());
148143
collapsed.segment_end_coordinates.back().target_phantom =
149144
leggy_result.segment_end_coordinates[i].target_phantom;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "osrm",
3-
"version": "5.16.0",
3+
"version": "5.16.1",
44
"private": false,
55
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
66
"dependencies": {

unit_tests/engine/collapse_internal_route_result.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ BOOST_AUTO_TEST_CASE(unchanged_collapse_route_result)
3838

3939
BOOST_AUTO_TEST_CASE(two_legs_to_one_leg)
4040
{
41+
// from_edge_based_node, turn_via_node, name_id, is_segregated, weight_until_turn,
42+
// weight_of_turn,
43+
// duration_until_turn, duration_of_turn, turn_instruction, lane_data, travel_mode, classes,
44+
// entry_class, datasource_id, pre_turn_bearing, post_turn_bearing, left_hand
4145
PathData pathy{0, 2, 17, false, 2, 3, 4, 5, 0, {}, 4, 2, {}, 2, {1.0}, {1.0}, false};
4246
PathData kathy{0, 1, 16, false, 1, 2, 3, 4, 1, {}, 3, 1, {}, 1, {2.0}, {3.0}, false};
4347
PathData cathy{0, 3, 16, false, 1, 2, 3, 4, 1, {}, 3, 1, {}, 1, {2.0}, {3.0}, false};
@@ -61,10 +65,11 @@ BOOST_AUTO_TEST_CASE(two_legs_to_one_leg)
6165
BOOST_CHECK_EQUAL(collapsed.segment_end_coordinates[0].target_phantom.forward_segment_id.id,
6266
12);
6367
BOOST_CHECK_EQUAL(collapsed.segment_end_coordinates[0].source_phantom.forward_segment_id.id, 1);
64-
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0].size(), 3);
68+
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0].size(), 4);
6569
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][0].turn_via_node, 2);
6670
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][1].turn_via_node, 1);
67-
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][2].turn_via_node, 3);
71+
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][2].turn_via_node, 1);
72+
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][3].turn_via_node, 3);
6873
}
6974

7075
BOOST_AUTO_TEST_CASE(three_legs_to_two_legs)
@@ -101,13 +106,14 @@ BOOST_AUTO_TEST_CASE(three_legs_to_two_legs)
101106
BOOST_CHECK_EQUAL(collapsed.segment_end_coordinates[1].target_phantom.forward_segment_id.id,
102107
18);
103108
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0].size(), 2);
104-
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1].size(), 4);
109+
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1].size(), 5);
105110
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][0].turn_via_node, 2);
106111
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[0][1].turn_via_node, 1);
107112
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1][0].turn_via_node, 1);
108113
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1][1].turn_via_node, 5);
109114
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1][2].turn_via_node, 3);
110-
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1][3].turn_via_node, 4);
115+
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1][3].turn_via_node, 3);
116+
BOOST_CHECK_EQUAL(collapsed.unpacked_path_segments[1][4].turn_via_node, 4);
111117
}
112118

113119
BOOST_AUTO_TEST_CASE(two_legs_to_two_legs)

0 commit comments

Comments
 (0)