Animated marine traffic in the San Francisco Bay

Sam Kronick
Mon, 19 Dec 2016 07:00:00 -0500

Though it may be easy to overlook from life on land, the waters of San Francisco Bay are alive with activity at all hours of the day. To visualize how boats navigate the Bay, I built an animated map using Mapbox GL JS that takes you on a guided tour through 24 hours of marine telemetry data captured by the US Coast Guard.

Scroll through the explanation in the sidebar on the left or view the full-screen demo to explore the map.

Seeing the data in motion lets you discover interesting patterns that you might miss in a static map, such as this group of fishing boats leaving Half Moon Bay around the same time in the morning:

or the number of smaller boats that zip by a big ship as it turns around 180 degrees in the Oakland turning basin:

or the general traffic patterns in the central bay:

How we made the map

This visualization pulls together data from two sources: ship telemetry data from the US Coast Guard and underwater depth (bathymetry) data provided by NOAA. The data from these sources were not in a convenient format for visualization, so I wrote a couple of scripts to convert them to GeoJSON and loaded them in to Mapbox Studio. I styled the data and basemap in Studio, with additional customization on the client-side using data-driven styling. I used the built-in symbol rendering features of Mapbox GL JS to draw the ships, so they always render and move smoothly with the rest of the map.

To animate the ships on the map, I update the position of each ship symbol with every frame. The US Coast Guard telemetry dataset includes timestamps for each data point at one-minute intervals, so I can calculate the position for each ship at any given time. This also means you are seeing the real temporal patterns of ship movements, not just simulated motion along a path.

Build your own

We would love to see your animated maps. If you have something to share, tweet us at @Mapbox!