Categories
Data

Defining Urban Data Science

I’m a co-author on a new article out inĀ Environment and Planning B: Urban Analytics and City Science titled “A Roundtable Discussion: Defining Urban Data Science” (download free PDF). It arises from a panel discussion I participated in at the 2019 AAG Annual Meeting in DC. Vanessa Frias-Martinez, Song Gao, Ate Poorthuis, and Wenfei Xu joined me on the panel, which was organized and moderated by Wei Kang, Taylor Oshan, and Levi Wolf. From the abstract:

Categories
Data

New Article in Frontiers in Neurology

I recently teamed up with an international group of public health researchers and spatial analysts to co-author an article, An Introduction to Software Tools, Data, and Services for Geospatial Analysis of Stroke Services, that has been accepted for publication atĀ Frontiers in Neurology (download free PDF).

Hospital catchment basin for stroke services. Spatial analysis in python, geopandas, osmnx.

Categories
Data

US Street Network Models and Measures

My new article, “Street Network Models and Measures for Every U.S. City, County, Urbanized Area, Census Tract, and Zillow-Defined Neighborhood” has been published in Urban Science. This paper reports results from a broader project that collected raw street network data from OpenStreetMap using the Python-based OSMnx software for every U.S. city and town, county, urbanized area, census tract, and Zillow-defined neighborhood boundary. It constructed nonplanar directed multigraphs for each and analyzed their structural and morphological characteristics.

The resulting public data repository contains over 110,000 processed, cleaned street network graphs (which in turn comprise over 55 million nodes and over 137 million edges) at various scalesā€”comprehensively covering the entire U.S.ā€”archived as reusable open-source GraphML files, node/edge lists, and ESRI shapefiles that can be immediately loaded and analyzed in standard tools such as ArcGIS, QGIS, NetworkX, graph-tool, igraph, or Gephi.

Categories
Data

Street Network Analysis in a Docker Container

Containerization is the way of the future present.Ā I’ve heard feedback from some folks over the past few months who would like to play around with OSMnx for street network analysis, transport modeling, and urban designā€”but can’t because they can’t install Python and its data science stack on their computers. Furthermore, it would be nice to have a consistent reference environment to deploy on AWS or elsewhere in the cloud.

So, I’ve created a docker image containing OSMnx, Jupyter, and the rest of the Python geospatial data science stack, available on docker hubĀ alongside additional usage instructions. If you’re starting from scratch, you can get started in four simple steps:

Categories
Data

Network-Based Spatial Clustering

Jobs, establishments, and other amenities tend to agglomerate and cluster in cities. To identify these agglomerations and explore their causes and effects, we often use spatial clustering algorithms. However, urban space cannot simply be traversed as-the-crow-flies: human mobility is network-constrained. To properly model agglomeration along a city’s street network, we must use network-based spatial clustering.

The code for this example can be found in this GitHub repo. We use OSMnx to download and assemble the street network for a small city. We also have a dataframe of points representing the locations of (fake) restaurants in this city. Our restaurants cluster into distinct districts, as manyĀ establishments and industries tend to do:

firm locations on the street network to be clustered: python, osmnx, matplotlib, scipy, scikit-learn, geopandas

Categories
Data

OSMnx Features Round-Up

OSMnx is a Python package for quickly and easily downloading, modeling, analyzing, and visualizing street networks and other spatial data from OpenStreetMap. Here’s a quick round-up of recent updates to OSMnx. I’ll try to keep this up to date as a single reference source. A lot of new features have appeared in the past few months, and people have been asking about what’s new and what’s possible. You can:

  • Download and model street networks or other networked infrastructure anywhere in the world with a single line of code
  • Download any other spatial geometries, place boundaries, building footprints, or points of interest as a GeoDataFrame
  • Download by city name, polygon, bounding box, or point/address + network distance
  • Download drivable, walkable, bikeable, or all street networks
  • Download node elevations and calculate edge grades (inclines)
  • Impute missing speeds and calculate graph edge travel times
  • Simplify and correct the network’s topology to clean-up nodes and consolidate intersections
  • Fast map-matching of points, routes, or trajectories to nearest graph edges or nodes
  • Save networks to disk as shapefiles, geopackages, and GraphML
  • Save/load street network to/from a local .osm xml file
  • Conduct topological and spatial analyses to automatically calculate dozens of indicators
  • Calculate and visualize street bearings and orientations
  • Calculate and visualize shortest-path routes that minimize distance, travel time, elevation, etc
  • Visualize street networks as a static map or interactive leaflet web map
  • Visualize travel distance and travel time with isoline and isochrone maps
  • Plot figure-ground diagrams of street networks and building footprints
Categories
Data

Street Network Orientation

OSMnx is a Python package for easily downloading and analyzing street networks anywhere in the world. Among other analyses, we can use it to explore street network orientation. That is, what are the bearings and spatial orientations of the streets in the network? All of the code for this example is in this GitHub notebook. First we use OSMnx to download the street network of Moraga, California, a small town in the hills just east of Berkeley:

Moraga, California street network OSMnx OpenStreetMap Python

OSMnx automatically calculates all of the streets’ bearings. Specifically it calculates the compass bearing from each directed edge’s origin nodeĀ u to its destination nodeĀ v. Now we can visualize these bearings, binned together as a histogram to get a sense of the relative frequency of the streets’ spatial orientations. Or better yet, we can project that histogram as a polar plot to match the compass bearings:

Moraga, California street network orientation edge bearings polar plot OSMnx OpenStreetMap Python

Categories
Data

Urban Street Network Centrality

Check out the journal article about OSMnx.

We can measure and visualize how “important” a node or an edge is in a network by calculating its centrality. Lots of flavors of centrality exist in network science, including closeness, betweenness, degree, eigenvector, and PageRank. Closeness centrality measures the average shortest path between each node in the network and every other node: more central nodes are closer to all other nodes. We can calculate this easily with OSMnx, as seen in this GitHub demo. For example, here is the node closeness centrality for Piedmont, California:

Urban street network graph node closeness and betweenness centrality

Categories
Data

Geoff vs Jeff

My life in one chart:

Geoff vs Jeff Google Ngram

This chart comes from Google’s Ngram viewer. In computational linguistics, an n-gram is a consecutive set of n items in order in some sequence of text. Here, we are comparing the frequency of the 1-gram “Geoff” to the 1-gram “Jeff” across Google’s corpus of books. As you can see, Jeff has been more popular than Geoff since, well, ever… leading to my endless problems trying to get people to spell and pronounce my name correctly. The good news is Jeff has recently taken a downturn. Score one for the Geoffs!

Categories
Data

OSMnx and Street Network Elevation Data

Check out the journal article about OSMnx.

OSMnx can now download street network elevation data for anywhere in the world. In one line of code it downloads the elevation in meters of each network node, and in one more line of code it can calculate every street (i.e., edge) grade. Here is the complete street network of San Francisco, California, with nodes colored according to their elevation:

OSMnx street network elevation data for San Francisco, California to calculate street grade and steepness