39 — OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks

Geoff Boeing (10.1016/j.compenvurbsys.2017.05.004)

Read on 29 September 2017
#python  #urban-design  #graphs  #graph-theory  #GIS  #open-street-map  #networks 

I recently used OSMnx on a fun project and so I was excited to see that the website listed this paper. OpenStreetMap is an amazing free resource that — among many other things — enables API access to an enormous network of roads and their metadata.

“Graph theory,” notes Boeing, “was born in the 18th century when Leonhard Euler presented his famous Seven Bridges of Königsberg problem.” Perhaps true — albeit a bit apocryphal — but certainly a very attractive introduction to a paper about using a graph-theory Python library (networkx) to represent streets and intersections.

OSMnx implements the OSM API by converting downloaded streets and intersections into a networkx.DiGraph, which enables common graph math and operations. To encode information about roadways, the graphs generated by OSMnx are weighted (based on qualities of the physical road), and embedded in 2D, based on the geography of the street network. (Directionality encodes one-way roadways.)

The library is outrageously easy to use, and includes great query features for downloading select data (you can download by bounding box, distance from a point, or arbitrary shape, such as a state boundary). If I had found this library earlier in my project, I probably would not have used any other libraries besides this one.

This library also includes powerful visualization and graph simplification tools; you could imagine that an unsimplified graph contains a lot of degree=2 nodes along a stretch of road. It also includes a large toolbox of algorithms to calculate useful road analysis features, such as length of roads, average intersection density, centrality, and many others. It also includes graph-traversal algorithms for way-finding.

This paper performs a case-study on streets of Portland, which is very picture-heavy (a pleasure to read) and provides demo-code — which is almost unnecessary, since the library is so easy to set up that in three lines, you can have a render of a city ready to go.