diff --git a/features/guidance/turn-angles.feature b/features/guidance/turn-angles.feature index 60c751c08..c15b58f34 100644 --- a/features/guidance/turn-angles.feature +++ b/features/guidance/turn-angles.feature @@ -1372,7 +1372,9 @@ Feature: Simple Turns | waypoints | route | | g,e | abcde,abcde | - Scenario: small ticks in roads + # 4205 + # https://www.openstreetmap.org/node/36153635#map=19/51.97548/7.61795 + Scenario: merging onto a through street Given the node map """ e @@ -1439,7 +1441,6 @@ Feature: Simple Turns | fcde | no | jahn | When I route I should get - | waypoints | route | turns | - | a,f | fww,jahn,jahn | depart,turn straight,arrive | - | a,e | fww,jahn,jahn | depart,turn left,arrive | - + | waypoints | route | turns | + | a,f | fww,jahn,jahn | depart,turn right,arrive | + | a,e | fww,jahn,jahn | depart,turn left,arrive | diff --git a/src/extractor/guidance/intersection_handler.cpp b/src/extractor/guidance/intersection_handler.cpp index 129b65769..d4e7fb3bf 100644 --- a/src/extractor/guidance/intersection_handler.cpp +++ b/src/extractor/guidance/intersection_handler.cpp @@ -119,7 +119,9 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t const double constexpr MAX_COLLAPSE_DISTANCE = 30; // in normal road condidtions, we check if the turn is nearly straight. // Doing so, we widen the angle that a turn is considered straight, but since it - // is obvious, the choice is arguably better. + // is obvious, the choice is arguably better. We need the road to continue for a + // bit though, until we assume this is safe to do. In addition, the angle cannot + // get too wide, so we only allow narrow turn angles to begin with. // FIXME this requires https://github.com/Project-OSRM/osrm-backend/pull/2399, // since `distance` does not refer to an actual distance but rather to the @@ -129,12 +131,12 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t const auto distance = util::coordinate_calculation::haversineDistance( coordinates[node_based_graph.GetTarget(via_edge)], coordinates[node_based_graph.GetTarget(road.eid)]); - return { - TurnType::Turn, - (angularDeviation(road.angle, STRAIGHT_ANGLE) < FUZZY_ANGLE_DIFFERENCE || - distance > 2 * MAX_COLLAPSE_DISTANCE) - ? DirectionModifier::Straight - : getTurnDirection(road.angle)}; + + return {TurnType::Turn, + (angularDeviation(road.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE && + distance > 2 * MAX_COLLAPSE_DISTANCE) + ? DirectionModifier::Straight + : getTurnDirection(road.angle)}; } } else