diff --git a/CHANGELOG.md b/CHANGELOG.md index e4266932f..4bfe43d31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Fixed a bug where post-processing instructions (e.g. left + left -> uturn) could result in false pronunciations - Fixes a bug where a bearing range of zero would cause exhaustive graph traversals - Fixes a bug where certain looped geometries could cause an infinite loop during extraction + - Fixed a bug where some roads could be falsly identified as sliproads - Infrastructure: - Adds a feature to limit results in nearest service with a default of 100 in `osrm-routed` diff --git a/features/guidance/dedicated-turn-roads.feature b/features/guidance/dedicated-turn-roads.feature index aa9e9be37..210317ad4 100644 --- a/features/guidance/dedicated-turn-roads.feature +++ b/features/guidance/dedicated-turn-roads.feature @@ -264,3 +264,52 @@ Feature: Slipways and Dedicated Turn Lanes When I route I should get | waypoints | bearings | route | turns | | b,a | 90,10 270,10 | circled,circled | depart,arrive | + + #http://www.openstreetmap.org/#map=19/38.90597/-77.01276 + Scenario: Don't falsly classify as sliproads + Given the node map + # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 + | | | | | | | | | | | | | | | | | | | | | | | | j | | | | | | | | + | a | b | | | | | | | | | | | | | | | | | | | | | | c | | | | | | | d | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | e | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | 1 | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | f | | | | | g | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | i | | | | | | | h | + + And the ways + | nodes | name | highway | oneway | maxspeed | + | abcd | new york | primary | yes | 35 | + | befgh | m street | secondary | yes | 35 | + | igcj | 1st street | tertiary | no | 20 | + + And the nodes + | node | highway | + | c | traffic_signals | + | g | traffic_signals | + + When I route I should get + | waypoints | route | turns | # | + | a,d | new york,new york | depart,arrive | this is the sinatra route | + | a,j | new york,1st street,1st street | depart,turn left,arrive | | + | a,1 | new york,m street,1st street,1st street | depart,turn right,turn left,arrive | this can false be seen as a sliproad | diff --git a/src/extractor/guidance/sliproad_handler.cpp b/src/extractor/guidance/sliproad_handler.cpp index 6c8359385..d8f63256c 100644 --- a/src/extractor/guidance/sliproad_handler.cpp +++ b/src/extractor/guidance/sliproad_handler.cpp @@ -139,7 +139,6 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection) return intersection; const auto source_edge_data = node_based_graph.GetEdgeData(source_edge_id); - // check whether the continue road is valid const auto check_valid = [this, source_edge_data](const ConnectedRoad &road) { const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid); @@ -192,6 +191,21 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection) return intersection; }(intersection_node_id); + const auto link_data = node_based_graph.GetEdgeData(road.turn.eid); + // Check if the road continues here + const bool is_through_street = + target_intersection.end() != + std::find_if(target_intersection.begin() + 1, + target_intersection.end(), + [this, &link_data](const ConnectedRoad &road) { + return node_based_graph.GetEdgeData(road.turn.eid).name_id == + link_data.name_id; + }); + + // if the sliproad candidate is a through street, we cannot handle it as a sliproad + if (is_through_street) + continue; + for (const auto &candidate_road : target_intersection) { const auto &candidate_data = node_based_graph.GetEdgeData(candidate_road.turn.eid);