observe
Street continuity analysis. Identifies continuous street sequences — chains of connected street segments that share the same name, route number, or highway classification — and computes continuity metrics from NetworkX graphs. For network centrality methods, see the networks module.
ContinuityEntry
State management for an individual street continuity entry. This corresponds to an individual street name, route name or number, or highway type.
StreetContinuityReport
State management for a collection of street continuity metrics. Each key in the entries attribute corresponds to a ContinuityEntry.
street_continuity
Compute the street continuity for a given graph. This requires a graph with names, routes, or highways edge keys corresponding to the selected method parameter. These keys are available if importing an OSM network with osm_graph_from_poly or if importing OS Open Roads data with nx_from_open_roads.
Parameters
A networkX MultiGraph with a crs attribute denoting a projected coordinate system, containing x and y node attributes, and geom edge attributes containing LineString geoms. Edges should contain “names”, “routes”, or “highways” keys corresponding to the specified method parameter.
The type of continuity metric to compute, where available options are “names”, “routes”, or “highways”.
Returns
A copy of the input networkX MultiGraph with new edge keys corresponding to the calculated route continuity metric. The metrics will be stored in ‘length’ and ‘count’ forms for the specified method, with keys formatted according to f"{method}_cont_by_{form}". For example, when computing “names” continuity, the names_cont_by_count and names_cont_by_length keys will be added to the returned networkX MultiGraph.
An instance of StreetContinuityReport containing the computed state for the selected method.
Notes
For worked examples, see the Street Continuity from OSM recipe.
hybrid_street_continuity
Compute the street continuity for a given graph by combining route and name-based continuity. Where a named route (e.g. a bus route or highway number) runs along streets with consistent names, the two sources of continuity information are merged to produce a more complete picture of coherent street sequences.
Parameters
A networkX MultiGraph with a crs attribute denoting a projected coordinate system, containing x and y node attributes, and geom edge attributes containing LineString geoms. Edges should contain “names”, “routes”, or “highways” keys corresponding to the specified method parameter.
Returns
A copy of the input networkX MultiGraph with new edge keys corresponding to the calculated route continuity metric. The metrics will be stored in ‘hybrid_cont_by_length’ and ‘hybrid_cont_by_count’ keys.
An instance of StreetContinuityReport containing the computed state for the “hybrid” method.