OpenAQ live updating maps via MTS

Mapbox
maps for developers
3 min readSep 14, 2020

--

By: Jonni Walker

The scope of poor air quality caused by fires on the West Coast is incredibly apparent in the open data collected by OpenAQ, I just uploaded the CSV to Studio. This is a massive set of data, all dynamically mapped using the new Mapbox Tiling Service (MTS) that automatically creates custom vector tilesets by providing source data (GeoJSON files) with transformation rules called recipes. These recipes specify how to transform that data. MTS then creates a new tileset with that recipe and publishes it.

I used a country shapefile to “mask’ out the surrounding countries and a filter to only label the U.S. State names. Then I decided to use extrusions on the data to emphasise the level of air pollution across the country, the higher the extrusion, the worse the air quality is. I felt this portrayed the current wildfire (and associated air quality) situation in the West of the United States. I also used the monochromatic styling of satellite imagery with a saturation level of -0.85.

The screenshot from Studio (below) shows how I am using the fill extrusion on the value. I am also duplicating the extrusions, set at different heights and very low opacities, to create a colour gradient from the bottom to the top of the extrusion.

To create these tilesets using MTS, just upload an in line-delimited GeoJSON format. A file formatted as line-delimited GeoJSON contains one or more GeoJSON Feature objects separated by newlines. Learn more about how line-delimited GeoJSON is used by MTS in the MTS documentation. To create a tileset source, you will use the Tilesets CLI upload-source command.

Here is the same air quality data, but this time using the glow effect (firefly technique) in Studio, employing a light opacity to “mask’ out the surrounding countries rather than fully blocking out.

Recipes provide options for generating vector tiles such as degree of simplification, zoom level extent, geometry unioning, attribute manipulation, etc, you can see all detail about all the available configuration options in the Recipe reference.

Tilesets generated using MTS can be used in any map styles and can be composited with any other vector tilesets, read the full documentation.

Jonni Walker is a Cartographer at Mapbox based in the UK. He’s doing a series of posts this summer on his cartography called “Painting with Mapbox Studio”. He’ll share the principles used in his stunning designs and some tips for using the techniques within your projects.

Maps feature data from Mapbox and OpenStreetMap and their data partners.

--

--

mapping tools for developers + precise location data to change the way we explore the world