New tutorial: 15-minute city interactive map
16 Aug 2023
Earlier this year, I published an article on my blog titled Is Seattle a 15-minute city? It depends on where you want to walk. The article got a lot of interest both online and in the Seattle news, and a fair number of people reached out asking to create similar maps in other cities.
To that end, I’ve create a tutorial with all the code needed to run a walkability analysis for any city and display the results on an interactive map. The tutorial code and instructions are available for free on Github.
Explore the tutorial on Github
If you run through the tutorial, you will produce an interactive walkability map that can be embedded in web pages or shared as-is. You will also produce a detailed table of travel time results for each block in the study area.
If you end up publishing your own analysis inspired by this code, I’d love to see it! You can reach me over email, on LinkedIn, or on Twitter.
Changes from the original article
I’ve tailored the tutorial to be easily adapted to other cities, destinations, and modes of transit. This required a few changes from the original analysis:
- The code runs everything: All file downloads, formatting, and edits happen directly in R scripts.
- All settings are in a configuration file: The walkability analysis can be easily translated to a different city by changing the settings in that file.
- Different destinations: Because some destination types weren’t easily generalizable to other cities, detailed in the next section.
- Switching to the R5 routing engine: A big improvement in terms of speed and features, detailed below.
In any walkability analysis, you should extensively vet the destinations scraped from publicly-available data before estimating travel times. For the sake of reproducibility, the tutorial repository highlights where the user should vet their results, but does not build a vetting step into the code. That means that the tutorial results should only be used as an example, and the map from the original article is still the best tool for understanding walkability across Seattle.
Different destinations
In the original Seattle walkability analysis, I included options to visualize walking time to Seattle public schools. However, because attendance areas often don’t reflect proximity, and because of the School Choice and Option School programs, Seattle public school students often don’t attend the schools that are geographically closest to them. There are reasonable ways to visualize accessibility to particular sets of schools in the district, but they threatened the generality of the tutorial, so I excluded schools from the replication package. You can find SPS school locations and attendance areas on the Seattle Open Data Portal.
In the original analysis, I also included “Bus stops connecting to downtown” as a destination. This involved intersecting bus routes with the boundaries of downtown and then including only stops along those routes. To keep the tutorial general, I instead measured distance to any active transit stop, with the Link split into its own category.
Switching to R5
In the original walkability analysis, I spun up an OpenRouteService server on my local computer, then repeatedly queried origin-destination pairs using the “openrouteservice” R package. In this analysis, I switched to querying R5 using the “r5r” R package. There are a lot of things to like about R5 and r5r:
- Easier setup: You can set up and query an R5 Java machine entirely through the “r5r” R interface, compared to a multi-step Docker setup process for OpenRouteService.
- Faster and more reliable: I found that “r5r” was about 100x faster than the OpenRouteService R interface, cycling through millions of origin-destination pairs in minutes rather than hours. R5 also consistently returned results, requiring less error handling on the user’s end.
- Adjusts walking and biking speeds to account for street slopes: An important feature for Seattle, where steep hills can impede travel between geographically close locations.
- More features for measuring urban mobility: R5 parses GTFS feeds to calculate transit routes; interfaces nicely with the “sf” R package for spatial analysis; and offers more tools for understanding accessibility across multiple transit modes and destinations.
If you want to incorporate real-world traffic, biking, and transit data into your accessibility analysis, please feel free to get in touch!
–