Remove assertions that could be triggered by bad data. (#3469)
When two consecutive nodes have identical coordinates, there is no valid bearing. For now, make equal nodes have bearing 0. Full fix still needs to be done via https://github.com/Project-OSRM/osrm-backend/issues/3470.
This commit is contained in:
committed by
Daniel Patterson
parent
f7e8581a1b
commit
15c8fd326f
@@ -204,6 +204,20 @@ bool RoundaboutHandler::qualifiesAsRoundaboutIntersection(
|
||||
|
||||
result.push_back(
|
||||
util::coordinate_calculation::bearing(src_coordinate, next_coordinate));
|
||||
|
||||
// OSM data sometimes contains duplicated nodes with identical coordinates, or
|
||||
// because of coordinate precision rounding, end up at the same coordinate.
|
||||
// It's impossible to calculate a bearing between these, so we log a warning
|
||||
// that the data should be checked.
|
||||
// The bearing calculation should return 0 in these cases, which may not be correct,
|
||||
// but is at least not random.
|
||||
if (src_coordinate == next_coordinate)
|
||||
{
|
||||
util::Log(logDEBUG) << "Zero length segment at " << next_coordinate
|
||||
<< " could cause invalid roundabout exit bearings";
|
||||
BOOST_ASSERT(std::abs(result.back()) <= 0.1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user