Remark
These lecture notes are in early access and will continue to evolve as examples are tested against current OpenStreetMap data and OSMnx releases.
Section goal
Turn streets and other connected features into validated graphs, then use network distance, travel time, and connectivity to answer routing and accessibility questions.
5. Network Analysis and Spatial Networks#
Chapter 4 introduced vector geometries, spatial relationships, overlays, and reproducible data preparation. This chapter uses those foundations to analyze connected features such as streets, paths, railways, and other infrastructure with NetworkX and OSMnx.
A network analysis workflow should:
define the mode, study area, and unit of analysis;
choose a query that matches the spatial extent and source coverage;
inspect graph direction, connectivity, geometry, and edge attributes;
choose a cost such as length, travel time, slope, or another documented weight;
validate routes, components, and reachable features; and
report the source date, OSMnx version, assumptions, and output.
Network objects and questions
Table 5.1 lists the objects that a network analysis works with and the question that each one answers.
Object |
Represents |
Example question |
|---|---|---|
Node |
An intersection, endpoint, or access point |
Which destinations can be reached? |
Edge |
A directed or undirected connection |
How long or costly is this street? |
Graph |
Connected nodes and edges |
What is the least-cost route? |
Feature layer |
A place boundary or point of interest |
Which facilities are served by the network? |
An OSMnx graph is not interchangeable with a line layer. A line can look connected without sharing endpoints, and a café near a node is not a network node until it is deliberately connected to the graph.
Working with live OpenStreetMap data
The examples in this chapter use live OpenStreetMap requests. Start with a small area, enable caching, record the retrieval date, and do not interpret raw node or edge counts as quality scores without checking coverage and query choices.