From 341a5345da76f75f2b24af55a07dcf4cf8ac2e0e Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Thu, 18 Jan 2018 22:28:17 +0100 Subject: [PATCH] Ignore no_*_on_red turn restrictions (#4804) --- CHANGELOG.md | 1 + features/car/restrictions.feature | 27 +++++++++++++++++++++++++++ src/extractor/restriction_parser.cpp | 4 ++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb72e4554..ca4675bcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Bugfixes: - FIXED #4704: Fixed regression in bearings reordering introduced in 5.13 [#4704](https://github.com/Project-OSRM/osrm-backend/issues/4704) - FIXED #4781: Fixed overflow exceptions in percent-encoding parsing + - FIXED #4804: Ignore no_*_on_red turn restrictions - Guidance: - CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706) - Profile: diff --git a/features/car/restrictions.feature b/features/car/restrictions.feature index d9fb76adf..63e85a092 100644 --- a/features/car/restrictions.feature +++ b/features/car/restrictions.feature @@ -141,6 +141,33 @@ Feature: Car - Turn restrictions | c | a | cj,aj,aj | | c | b | cj,bj,bj | + @no_turning + Scenario: Car - Ignore no_*_on_red relations + Given the node map + """ + a + d j b + c + """ + + And the ways + | nodes | oneway | + | cj | yes | + | aj | -1 | + | dj | -1 | + | bj | -1 | + + And the relations + | type | way:from | way:to | node:via | restriction | + | restriction | cj | dj | j | no_turn_on_red | + | restriction | cj | bj | j | no_right_turn_on_red | + + When I route I should get + | from | to | route | + | c | d | cj,dj,dj | + | c | a | cj,aj,aj | + | c | b | cj,bj,bj | + @only_turning Scenario: Car - Only left turn Given the node map diff --git a/src/extractor/restriction_parser.cpp b/src/extractor/restriction_parser.cpp index 135a3db68..f991c9e50 100644 --- a/src/extractor/restriction_parser.cpp +++ b/src/extractor/restriction_parser.cpp @@ -107,12 +107,12 @@ RestrictionParser::TryParse(const osmium::Relation &relation) const const std::string value(fi_begin->value()); // documented OSM restriction tags start either with only_* or no_*; - // check and return on these values, and ignore unrecognized values + // check and return on these values, and ignore no_*_on_red or unrecognized values if (value.find("only_") == 0) { is_only_restriction = true; } - else if (value.find("no_") == 0) + else if (value.find("no_") == 0 && !boost::algorithm::ends_with(value, "_on_red")) { is_only_restriction = false; }