Skip to content

Commit 89d32ec

Browse files
committed
Use smaller range for U-turn angles in map-matching
1 parent f5120d1 commit 89d32ec

File tree

5 files changed

+41
-3
lines changed

5 files changed

+41
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 5.16.2
2+
- Changes from 5.16.1:
3+
- Bugfixes:
4+
- FIXED #4920: Use smaller range for U-turn angles in map-matching [#4920](https://github.com/Project-OSRM/osrm-backend/pull/4920)
5+
16
# 5.16.1
27
- Changes from 5.16.0:
38
- Bugfixes

features/step_definitions/matching.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = function () {
7474

7575
if (headers.has('turns')) {
7676
if (json.matchings.length != 1) throw new Error('*** Checking turns only supported for matchings with one subtrace');
77-
turns = this.turnList(json.matchings[0].instructions);
77+
turns = this.turnList(json.matchings[0]);
7878
}
7979

8080
if (headers.has('route')) {

features/testbot/matching.feature

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,3 +684,34 @@ Feature: Basic Map Matching
684684
When I match I should get
685685
| trace | geometry | code |
686686
| bgkj | 1.000135,1,1.000135,0.99964,1.000387,0.999137 | Ok |
687+
688+
689+
@match @testbot
690+
Scenario: Regression test - waypoints trimming too much geometry
691+
Given the profile "testbot"
692+
Given a grid size of 10 meters
693+
Given the query options
694+
| geometries | geojson |
695+
Given the node map
696+
"""
697+
e
698+
;
699+
;
700+
a-----b-----c
701+
;
702+
;
703+
d
704+
"""
705+
And the ways
706+
| nodes |
707+
| abc |
708+
| bde |
709+
Given the query options
710+
| waypoints | 0;2 |
711+
| overview | full |
712+
| steps | true |
713+
When I match I should get
714+
| trace | geometry | turns | code |
715+
| abc | 1,0.99973,1.00027,0.99973,1.000539,0.99973 | depart,arrive | Ok |
716+
| abd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok |
717+
| abe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok |

include/engine/guidance/assemble_geometry.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
8080
prev_coordinate = coordinate;
8181

8282
const auto osm_node_id = facade.GetOSMNodeIDOfNode(path_point.turn_via_node);
83-
if (osm_node_id != geometry.osm_node_ids.back())
83+
84+
if (osm_node_id != geometry.osm_node_ids.back() ||
85+
path_point.turn_instruction.type != osrm::guidance::TurnType::NoTurn)
8486
{
8587
geometry.annotations.emplace_back(LegGeometry::Annotation{
8688
current_distance,

src/engine/plugins/match.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
4444
coordinates[current_coordinate + 1]);
4545

4646
// sharp turns indicate a possible uturn
47-
if (turn_angle <= 90.0 || turn_angle >= 270.0)
47+
if (turn_angle <= 45.0 || turn_angle >= 315.0)
4848
{
4949
allow_uturn = true;
5050
}

0 commit comments

Comments
 (0)