Skip to content

Commit

Permalink
Skip unsatisfiable mandatory turn restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
MKuranowski committed Jul 19, 2024
1 parent 845b344 commit 66bd0c8
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions pyroutelib3/osm/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,21 +478,11 @@ def _store_restriction(
change: Optional[_GraphChange] = _GraphChange(self.g)
cloned_nodes = change.restriction_as_cloned_nodes(osm_nodes)

if cloned_nodes is None and is_mandatory:
# Unsatisfiable mandatory restriction. Since the
if cloned_nodes is None:
osm_logger.warning(
"turn restriction %d: mandates a non-existing route - removing %d->%d from graph",
relation_id,
osm_nodes[0],
osm_nodes[1],
)
change = _GraphChange(self.g)
change.edges_to_remove.add((osm_nodes[0], osm_nodes[1]))

elif cloned_nodes is None:
osm_logger.warning(
"turn restriction %d: prohibits a non-existing route - skipping",
"turn restriction %d: %s a non-existing route - skipping",
relation_id,
"mandates" if is_mandatory else "prohibits",
)
change = None

Expand Down Expand Up @@ -663,7 +653,7 @@ class _InvalidTurnRestriction(ValueError):
"""

def __init__(self, restriction: reader.Relation, reason: str) -> None:
super().__init__(f"invalid turn restriction {restriction.id}: {reason}")
super().__init__(f"invalid turn restriction {restriction.id}: {reason} - skipping")
self.restriction = restriction
self.reason = reason

Expand Down

0 comments on commit 66bd0c8

Please sign in to comment.