Street Networks with OSMnx
Real-world street networks encode the spatial structure of cities. Using OSMnx, we can download actual OpenStreetMap data, convert it to NetworkX graphs, and compute network metrics that reveal fundamental properties of urban form -- from grid cities to organic medieval layouts.
1. Street Networks as Graphs
A street network is naturally represented as a graph \(G = (V, E)\) where:
- Nodes \(V\): intersections and dead-ends
- Edges \(E\): street segments connecting intersections
For a directed graph (one-way streets), the adjacency matrix \(\mathbf{A}\) has entries:
$$A_{ij} = \begin{cases} 1 & \text{if edge } (i, j) \in E \\ 0 & \text{otherwise} \end{cases}$$
OSMnx (Boeing, 2017) automates downloading OpenStreetMap data and constructing the primal graph representation. It handles:
- Simplification: merging degree-2 nodes into single edges
- Projection: converting lat/lon to local planar coordinates (UTM)
- Topology cleaning: removing self-loops and parallel edges
- Directionality: preserving one-way street information
2. Fundamental Network Metrics
Several metrics characterise the structure of a street network:
Node Degree
The degree \(k_i\) of node \(i\) counts its edges (streets meeting at that intersection):
$$k_i = \sum_j A_{ij}, \qquad \bar{k} = \frac{1}{|V|}\sum_i k_i = \frac{2|E|}{|V|}$$
Grid cities (e.g., Manhattan) have \(\bar{k} \approx 4\); suburban cul-de-sac networks have \(\bar{k} \approx 2.5\).
Betweenness Centrality
Measures how often a node lies on shortest paths between other nodes:
$$C_B(v) = \sum_{s \neq v \neq t} \frac{\sigma_{st}(v)}{\sigma_{st}}$$
where \(\sigma_{st}\) is the total number of shortest paths from \(s\) to \(t\), and \(\sigma_{st}(v)\) is how many pass through \(v\). High-betweenness nodes are critical for network flow -- removing them causes maximum disruption.
Network Density
The proportion of possible edges that actually exist:
$$\rho = \frac{|E|}{|V|(|V|-1)/2}$$
Street networks are extremely sparse: \(\rho \ll 1\)because each intersection connects to only a handful of streets.
Circuity
The ratio of network distance to Euclidean distance:
$$\text{circuity} = \frac{1}{|P|}\sum_{(s,t) \in P} \frac{d_{\text{network}}(s,t)}{d_{\text{Euclidean}}(s,t)}$$
Perfect grids have circuity \(\approx 1.27\) (the expected Manhattan distance ratio); winding medieval layouts can reach \(> 1.5\).
3. Degree Distribution and Urban Form
The degree distribution \(P(k)\) reveals the planning philosophy of a city. Unlike social networks (which are scale-free with \(P(k) \sim k^{-\gamma}\)), street networks are narrowly distributed:
$$P(k) \approx \begin{cases} \text{peaked at } k=3,4 & \text{grid cities} \\ \text{peaked at } k=1,3 & \text{suburban/cul-de-sac} \\ \text{broad, } k=3\text{--}6 & \text{organic/medieval} \end{cases}$$
The proportion of 4-way intersections (\(k = 4\)) versus 3-way T-junctions (\(k = 3\)) is a strong indicator of grid planning. Boeing (2019) found that \(P(k=4)/P(k=3)\) ranges from ~0.1 in suburban sprawl to ~2.0 in planned grid cities.
4. Python: Network Analysis with Synthetic Graph
We generate a synthetic street network (grid + random perturbation to mimic a real city) and compute all key metrics. This demonstrates the analysis pipeline that would be applied to real OSMnx data.
Street Network Analysis: Metrics and Visualisation
PythonClick Run to execute the Python code
Code will be executed with Python 3 on the server
5. Patterns Across Cities
Comparative analysis of street networks reveals systematic differences in urban form:
- Grid cities (Manhattan, Barcelona): high proportion of 4-way intersections, low circuity (~1.3), regular degree distribution peaked at \(k=4\)
- Organic cities (London, Tokyo): broader degree distribution, higher circuity (~1.5), more 3-way intersections
- Suburban networks: many dead-ends (\(k=1\)), tree-like structure, very high circuity, low connectivity
The orientation entropy of a network measures how uniformly street bearings are distributed. For a grid city with streets aligned to cardinal directions, the bearing distribution has four sharp peaks and low entropy. For organic cities, bearings are more uniformly distributed with higher entropy.