OSMnx · Clean up the graph

Project to a metric CRS, convert between graph representations, consolidate intersections, trim to a study area. Mirrors the Graph Operations panel.

Needs an active downloaded network (Download a street network).

1. Project to a metric CRS

Fresh downloads are in degrees. Project Graph reprojects to a local UTM zone so lengths and areas come out in meters. Do this before anything that measures distance.

Project Graph reprojects the network to UTM.

2. Convert representations

To Undirected collapses two-way streets into single edges, which orientation statistics require. To DiGraph gives a simple directed graph keyed by length. Graph → GDFs and GDFs → Graph round-trip through GeoDataFrames for external editing.

The conversion buttons.

3. Consolidate intersections

Complex junctions are often modeled as several nearby nodes. Tolerance (default 10 m) sets how close nodes have to be to merge into one. Worth doing before centrality analysis.

Consolidating intersections with a 10 m tolerance.

4. Truncate to a study area

Truncate by Distance works in network distance from a source node, not straight-line distance. Truncate by BBox and Truncate by Polygon clip to a rectangle or a polygon object.

Truncating the network by distance from a source node.

5. Keep the largest component

Largest Component drops disconnected fragments and leaves one contiguous network.

Largest Component removes disconnected fragments.

Next steps

Add edge attributes: lengths, speeds, travel times.

Back to top