iduedu.resolve_graph_edits¶
- iduedu.resolve_graph_edits(graph, edits, *, tolerance=5.0, speed_kmh=None, min_coverage=0.5, node_ids='next', edge_types=None)[source]¶
Bind geometric edits to the current graph.
Anchors of
removeandupdateselect the edges that lie along them withintolerance; an edge covered only in part is split at the ends of the anchor, and only the covered part is changed. Crossing streets are not selected: the edge has to run along the anchor. Each end of anaddline is attached to a node withintolerance, or splits the nearest edge withintoleranceat the projection of the end, or becomes a new node. Split edges keep their attributes, with length and travel time shared out by length.Edits that cannot be bound are skipped and reported instead of raising, so a stored scenario still applies after the graph is rebuilt.
- Parameters:
graph (
UrbanGraph) – Graph in a projected CRS;toleranceis in its units.edits (
GraphEdits) – Edits to bind.tolerance (
float) – Search distance for nodes and edges, in metres for the graphs of the builders.speed_kmh (
float|None) – Speed of added lines that have neithertime_minnorspeed_kmh.min_coverage (
float) – Least share of an anchor’s length that the selected edges must cover; an anchor with less is reported and skipped.node_ids (
Literal['next','coordinates']) – Ids of new nodes:"next"continues after the largest id of the graph,"coordinates"packs the coordinates asrelabel_urban_graph()withby="coordinates"does.edge_types (
Iterable[str] |None) – Edit only edges whosetypeis one of these, and attach added lines only to their nodes, for example["walk"]in an intermodal graph, so that a closed street does not remove the transit edges drawn along it.
- Return type:
- Returns:
Pair
(changes, report).changesis applied withapply_urban_graph_changes().reporthas a row per skipped edit:kind("add","remove"or"update"),edit(its index),reasonandcoverage(the share of an anchor covered by the graph).- Raises:
ValueError – If the graph CRS is missing or geographic, the parameters are out of range, or a new node id is already in the graph.
KeyError – If
edge_typesis given and the edges have notypecolumn.