An Engineer's Blog

Back

San Francisco Traffic Density with kepler.glBlur image

Overview

While living in San Francisco briefly, I set up and ran kepler.gl ↗, Uber’s open-source geospatial explorer, to plot traffic density across the city by hour of day. The recording and the data below are Uber’s example material, nothing of mine. My own attempt, on New York City, is at the bottom.

Traffic density across San Francisco, played back hour by hour in kepler.gl.

The toolkit

kepler.gl ↗ builds on WebGL through deck.gl ↗ and runs in the browser at kepler.gl ↗, or self-hosted from the repo.

The animation follows three moves from Uber’s own walkthrough ↗:

  1. Load a dataset with street segments and an hour-of-day field, no account or install needed
  2. Color the layer by the density/speed column instead of a single color
  3. Add a filter on the hour field, which turns into the playback control at the bottom, animating the map across the day

The dataset is the speeds release of Uber Movement ↗, Uber’s program of aggregated travel-time and speed data for cities including San Francisco. The files were CSVs named movement-speeds-quarterly-by-hod-san-francisco-<year>-Q<n>.csv, speeds per street segment by hour of day (“hod”), with an hourly variant per month. Downloads went through movement.uber.com’s api/download/url endpoint, which issued signed S3 links per city and quarter; Uber’s movement-data-toolkit ↗ (mdt) automates those downloads and can join the speeds back to OpenStreetMap geometries for GeoJSON export. Movement shut down and the endpoint is dead now, so archived copies and mirrors are the only way back to these files.

What the playback shows

Before dawn only the arterials glow; density builds along the Market Street corridor and the SoMa grid through the morning peak; the whole downtown grid saturates through the afternoon and evening rush; after midnight it collapses back to a handful of corridors.

This is anecdotal, but the playback matches the city I walked, and seeing the map agree with my own commute is what sold me on the format.

My own attempt: New York City

In this 29-second recording, Movement’s street speed gradients color New York’s roads while government crash data sits on top: NHTSA’s FARS fatal crash records and the NYPD Motor Vehicle Collisions dataset. That is the combination from Uber’s traffic-safety walkthrough, aimed at traffic-related deaths and better urban planning.

Shortened simulation of NYC traffic and accident reports.

My survey participants were skeptical at first; the map reads as obvious once rendered, yet the same people would never pull crash statistics themselves. That is the value I see in kepler.gl: raw government data with a steep learning curve, made into something anyone can scrub through.

San Francisco Traffic Density with kepler.gl
https://tin.ng/blog/2021-11-18--san-francisco-traffic-density-kepler-gl
Author Tin Nguyen
Published at November 18, 2021
Comment seems to stuck. Try to refresh?✨