Check required tags of maneuver
relations
This commit is contained in:
parent
de13834c12
commit
5acf660f37
@ -7,6 +7,7 @@
|
|||||||
- CHANGED #4842: Lower priority links from a motorway now are used as motorway links [#4842](https://github.com/Project-OSRM/osrm-backend/pull/4842)
|
- CHANGED #4842: Lower priority links from a motorway now are used as motorway links [#4842](https://github.com/Project-OSRM/osrm-backend/pull/4842)
|
||||||
- CHANGED #4895: Use ramp bifurcations as fork intersections [#4895](https://github.com/Project-OSRM/osrm-backend/issues/4895)
|
- CHANGED #4895: Use ramp bifurcations as fork intersections [#4895](https://github.com/Project-OSRM/osrm-backend/issues/4895)
|
||||||
- CHANGED #4893: Handle motorway forks with links as normal motorway intersections[#4893](https://github.com/Project-OSRM/osrm-backend/issues/4893)
|
- CHANGED #4893: Handle motorway forks with links as normal motorway intersections[#4893](https://github.com/Project-OSRM/osrm-backend/issues/4893)
|
||||||
|
- FIXED #4905: Check required tags of `maneuver` relations [#4905](https://github.com/Project-OSRM/osrm-backend/pull/4905)
|
||||||
- Profile:
|
- Profile:
|
||||||
- FIXED: `highway=service` will now be used for restricted access, `access=private` is still disabled for snapping.
|
- FIXED: `highway=service` will now be used for restricted access, `access=private` is still disabled for snapping.
|
||||||
- ADDED #4775: Exposes more information to the turn function, now being able to set turn weights with highway and access information of the turn as well as other roads at the intersection [#4775](https://github.com/Project-OSRM/osrm-backend/issues/4775)
|
- ADDED #4775: Exposes more information to the turn function, now being able to set turn weights with highway and access information of the turn as well as other roads at the intersection [#4775](https://github.com/Project-OSRM/osrm-backend/issues/4775)
|
||||||
|
@ -198,11 +198,26 @@ Feature: Maneuver tag support
|
|||||||
| pt | 395 | no | primary |
|
| pt | 395 | no | primary |
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | node:via | way:via | way:to | maneuver |
|
| type | way:from | node:via | way:via | way:to | maneuver | # |
|
||||||
| maneuver | zy | p | yp | pt | suppress |
|
| maneuver | zy | p | yp | pt | suppress | original: depart,on ramp left,fork slight left,arrive |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:via | way:to | maneuver | # |
|
||||||
|
| maneuver | zy | yp | pb | suppress | invalid relation: missing node:via |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | node:via | way:via | way:to | maneuver | # |
|
||||||
|
| maneuver | p | yp | pb | suppress | invalid relation: missing way:from |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | node:via | way:via | maneuver | # |
|
||||||
|
| maneuver | zy | p | yp | suppress | invalid relation: missing way:to |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | node:via | way:via | way:to | maneuver | # |
|
||||||
|
| maneuver | zy | y, p | yp | pb | suppress | invalid relation: multiple node:via |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| z,t | NY Ave,395,395 | depart,on ramp left,arrive |
|
| z,t | NY Ave,395,395 | depart,on ramp left,arrive |
|
||||||
#original | z,t | NY Ave,,395,395 | depart,on ramp left,fork slight left,arrive |
|
| z,b | NY Ave,,4th St,4th St | depart,on ramp left,fork slight right,arrive |
|
||||||
|
|
||||||
|
@ -52,8 +52,10 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
|||||||
maneuver_override.maneuver = relation.tags().get_value_by_key("maneuver", "");
|
maneuver_override.maneuver = relation.tags().get_value_by_key("maneuver", "");
|
||||||
maneuver_override.direction = relation.tags().get_value_by_key("direction", "");
|
maneuver_override.direction = relation.tags().get_value_by_key("direction", "");
|
||||||
|
|
||||||
boost::optional<std::uint64_t> from = boost::none, via = boost::none, to = boost::none;
|
bool valid_relation = true;
|
||||||
std::vector<std::uint64_t> via_ways;
|
OSMNodeID via_node = SPECIAL_OSM_NODEID;
|
||||||
|
OSMWayID from = SPECIAL_OSM_WAYID, to = SPECIAL_OSM_WAYID;
|
||||||
|
std::vector<OSMWayID> via_ways;
|
||||||
|
|
||||||
for (const auto &member : relation.members())
|
for (const auto &member : relation.members())
|
||||||
{
|
{
|
||||||
@ -74,8 +76,9 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BOOST_ASSERT(0 == strcmp("via", role));
|
BOOST_ASSERT(0 == strcmp("via", role));
|
||||||
via = static_cast<std::uint64_t>(member.ref());
|
|
||||||
// set via node id
|
// set via node id
|
||||||
|
valid_relation &= via_node == SPECIAL_OSM_NODEID;
|
||||||
|
via_node = OSMNodeID{static_cast<std::uint64_t>(member.ref())};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case osmium::item_type::way:
|
case osmium::item_type::way:
|
||||||
@ -83,15 +86,17 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
|||||||
0 == strcmp("via", role));
|
0 == strcmp("via", role));
|
||||||
if (0 == strcmp("from", role))
|
if (0 == strcmp("from", role))
|
||||||
{
|
{
|
||||||
from = static_cast<std::uint64_t>(member.ref());
|
valid_relation &= from == SPECIAL_OSM_WAYID;
|
||||||
|
from = OSMWayID{static_cast<std::uint64_t>(member.ref())};
|
||||||
}
|
}
|
||||||
else if (0 == strcmp("to", role))
|
else if (0 == strcmp("to", role))
|
||||||
{
|
{
|
||||||
to = static_cast<std::uint64_t>(member.ref());
|
valid_relation &= to == SPECIAL_OSM_WAYID;
|
||||||
|
to = OSMWayID{static_cast<std::uint64_t>(member.ref())};
|
||||||
}
|
}
|
||||||
else if (0 == strcmp("via", role))
|
else if (0 == strcmp("via", role))
|
||||||
{
|
{
|
||||||
via_ways.push_back(static_cast<std::uint64_t>(member.ref()));
|
via_ways.push_back(OSMWayID{static_cast<std::uint64_t>(member.ref())});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case osmium::item_type::relation:
|
case osmium::item_type::relation:
|
||||||
@ -103,18 +108,17 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from && (via || via_ways.size() > 0) && to)
|
// Check required roles
|
||||||
|
valid_relation &= from != SPECIAL_OSM_WAYID;
|
||||||
|
valid_relation &= to != SPECIAL_OSM_WAYID;
|
||||||
|
valid_relation &= via_node != SPECIAL_OSM_NODEID;
|
||||||
|
|
||||||
|
if (valid_relation)
|
||||||
{
|
{
|
||||||
via_ways.insert(via_ways.begin(), *from);
|
maneuver_override.via_ways.push_back(from);
|
||||||
via_ways.push_back(*to);
|
std::copy(via_ways.begin(), via_ways.end(), std::back_inserter(maneuver_override.via_ways));
|
||||||
if (via)
|
maneuver_override.via_ways.push_back(to);
|
||||||
{
|
maneuver_override.via_node = via_node;
|
||||||
maneuver_override.via_node = {*via};
|
|
||||||
}
|
|
||||||
for (const auto &n : via_ways)
|
|
||||||
{
|
|
||||||
maneuver_override.via_ways.push_back(OSMWayID{n});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user