diff --git a/features/guidance/turn.feature b/features/guidance/turn.feature index f27f9c28e..80913f16b 100644 --- a/features/guidance/turn.feature +++ b/features/guidance/turn.feature @@ -1398,4 +1398,38 @@ Feature: Simple Turns When I route I should get | waypoints | route | turns | - | a,f | abc,cf,cf | depart,turn right,arrive | + | a,f | ,, | depart,turn right,arrive | + + # https://www.openstreetmap.org/#map=18/52.24071/10.29066 + Scenario: Turn for roads with no name, ref changes + Given the node map + """ + x + . + . + d + . . + . . + . . + e. . t . c . p. .f + . . + . . + . . + b + . + . + a + """ + + And the ways + | nodes | highway | ref | name | oneway | + | abp | tertiary | K 23 | | yes | + | pdx | tertiary | K 23 | | yes | + | xdt | tertiary | K 23 | | yes | + | tba | tertiary | K 23 | | yes | + | etcpf | primary | B 1 | | no | + + When I route I should get + | waypoints | route | turns | + | e,x | ,,, | depart,turn sharp left,turn right,arrive | + | f,a | ,, | depart,turn left,arrive | diff --git a/src/extractor/guidance/intersection_handler.cpp b/src/extractor/guidance/intersection_handler.cpp index dd43a4ba2..eee2ecfad 100644 --- a/src/extractor/guidance/intersection_handler.cpp +++ b/src/extractor/guidance/intersection_handler.cpp @@ -71,17 +71,19 @@ TurnType::Enum IntersectionHandler::findBasicTurnType(const EdgeID via_edge, if (!on_ramp && onto_ramp) return TurnType::OnRamp; - const auto &in_name = + const auto &in_name_id = node_data_container.GetAnnotation(node_based_graph.GetEdgeData(via_edge).annotation_data) .name_id; - const auto &out_name = + const auto &out_name_id = node_data_container.GetAnnotation(node_based_graph.GetEdgeData(road.eid).annotation_data) .name_id; + const auto &in_name = name_table.GetNameForID(in_name_id).to_string(); + const auto &out_name = name_table.GetNameForID(out_name_id).to_string(); const auto same_name = !util::guidance::requiresNameAnnounced( - in_name, out_name, name_table, street_name_suffix_table); + in_name_id, out_name_id, name_table, street_name_suffix_table); - if (in_name != EMPTY_NAMEID && out_name != EMPTY_NAMEID && same_name) + if (!in_name.empty() && !out_name.empty() && same_name) { return TurnType::Continue; }