Be more aggresive classifying Roundabout Intersections.

Roundabout Intersections are roundabouts with up to four ways and turn
angles which makes the turns obvious, e.g. as in:

```
    *
    *
* *   * *
    *
    *
```

but not

```
     *
    *
* *   *
    * *
     * *
```

For Roundabout Intersections we issue instructions such as
"turn <direction>" instead of "take the <nth> exit".

At the moment we have a limit on the radius for these Roundabout
Intersections of 5 meters. Which fails to classify a wide range of
Roundabout Intersections in the US (with the US-wide streets).

This changeset removes the Roundabout Intersection radius limit:

- if the roundabout is larger than a threshold and is named we classify
  it as a rotary

- if the roundabout matches our criteria for Roundabout Intersections
  we classify it as a Roundabout Intersection

- else fallback to plain old Roundabout

There is a second issue with determining a roundabout's radius.
But that's for another pull request (tracking in #2716).

References:
- https://github.com/Project-OSRM/osrm-backend/issues/2716
This commit is contained in:
Daniel J. Hofmann
2016-07-29 21:35:01 +02:00
committed by Patrick Niklaus
parent 2f6de614c1
commit d53c267129
8 changed files with 167 additions and 217 deletions
+17 -28
View File
@@ -321,37 +321,26 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
if (std::isinf(radius))
return RoundaboutType::Roundabout;
// not within the dedicated radii for special roundabouts
if (radius > MAX_ROUNDABOUT_INTERSECTION_RADIUS && radius <= MAX_ROUNDABOUT_RADIUS)
return RoundaboutType::Roundabout;
// Looks like a rotary: large roundabout with dedicated name
// do we have a dedicated name for the rotary, if not its a roundabout
// This function can theoretically fail if the roundabout name is partly
// used with a reference and without. This will be fixed automatically
// when we handle references separately or if the useage is more consistent
const auto is_rotary = 1 == roundabout_name_ids.size() && //
0 == connected_names.count(*roundabout_name_ids.begin()) && //
radius > MAX_ROUNDABOUT_RADIUS;
if (radius > MAX_ROUNDABOUT_RADIUS)
{
// do we have a dedicated name for the rotary, if not its a roundabout
// This function can theoretically fail if the roundabout name is partly
// used with a reference and without. This will be fixed automatically
// when we handle references separately or if the useage is more consistent
if (is_rotary)
return RoundaboutType::Rotary;
if (1 == roundabout_name_ids.size() &&
0 == connected_names.count(*roundabout_name_ids.begin()))
return RoundaboutType::Rotary;
else
return RoundaboutType::Roundabout;
}
// Looks like an intersection: four ways and turn angles are easy to distinguish
const auto is_roundabout_intersection = qualifiesAsRoundaboutIntersection(roundabout_nodes) &&
radius < MAX_ROUNDABOUT_INTERSECTION_RADIUS;
if (radius <= MAX_ROUNDABOUT_INTERSECTION_RADIUS)
{
const bool qualifies_as_roundabout_intersection =
qualifiesAsRoundaboutIntersection(roundabout_nodes);
if (qualifies_as_roundabout_intersection)
{
return RoundaboutType::RoundaboutIntersection;
}
else
{
return RoundaboutType::Roundabout;
}
}
if (is_roundabout_intersection)
return RoundaboutType::RoundaboutIntersection;
// Not a special case, just a normal roundabout
return RoundaboutType::Roundabout;
}