Tiling thousands of points to Vaccinate the States

Ann Millspaugh

May 20, 2021

Tiling thousands of points to Vaccinate the States

Guest

Ann Millspaugh

Guest

May 20, 2021

Vaccinate The States is building the most comprehensive list of vaccination sites in the US by aggregating official sources like Vaccines.gov, collecting information on websites and social media, and directly calling vaccination sites. This non-profit, community-driven effort has already mapped 40% more sites than any other source in the US. The map is critically important for local health officials and campaigns to ensure equitable access and reach historically disadvantaged communities most impacted by the crisis.

Vaccinate The States makes their information available in many forms for use by developers, designers, and non-technical users. Data is distributed as GeoJSON data through their API, as an embeddable map to use on websites like Alameda County's Vaccine Guidance site, and a Mapbox tileset for use in styles and apps

"Using Mapbox has been essential for Vaccinate The States to work on a national scale. In the race against the COVID-19 pandemic, we saved hundreds of essential engineering hours by using Mapbox Tile Service for production-ready geospatial infrastructure. Putting 70,000+ markers on a single interactive map is a significant engineering challenge, and we got to completely skip having to solve it." 
- Mike Skalnik, Engineering Lead, Vaccinate The States

To create map tiles of tens of thousands of points nationwide, Vaccinate the States used the Mapbox Tiling Service (MTS) to optimize their features at various zoom levels. Learn how they did it by following the steps below or simply embed a fully prepared Vaccinate The States map using these instructions.

How Vaccinate The States uses MTS to publish their data

A common challenge when tiling large, dense, datasets is keeping each data tile below the limit of 500k. The instructions below use MTS tiling rules specified in a recipe file to split the data into two layers, limit features based on certain attributes, and filter out non-essential attributes to save on tile size. It also uses zoom-element expressions to provide different attribute values across zoom levels. (Read more about alternate approaches to tiling large numbers of points in this documentation.)

To create tiles of vaccination site data with MTS, start by downloading the data for a state. This example uses data from California.

Create and publish the tileset with tilesets-cli using the recipe below. Before running the recipe, ensure tilesets-cli is configured by following this tutorial. Update tilesets-cli with a username and token then running these commands:

tilesets upload-source username vial vaccines.geojson

tilesets create username.vaccinate --recipe recipe.json --name "vaccinate"

tilesets publish username.vaccinate

RECIPE


 {
  "version": 1,
  "layers": {
    "vialLow": {
      "source": "mapbox://tileset-source/username/vial",
      "minzoom": 0,
      "maxzoom": 5,
      "features": {
        "bbox": [-179.149, -14.549, 179.779, 71.367],
        "attributes": {
          "allowed_output": ["id", "name"],
          "zoom_element": ["hours", "public_notes", "appointment_details"]
        }
      },
      "tiles": {
        "limit": [["lowest_where_in_distance", true, 16384, "id"]]
      }
    },
    "vialHigh": {
      "source": "mapbox://tileset-source/username/vial",
      "minzoom": 6,
      "maxzoom": 10,
      "features": {
        "bbox": [-179.149, -14.549, 179.779, 71.367],
        "attributes": {
          "allowed_output": [
            "appointment_method",
            "appointment_details",
            "website",
            "phone_number",
            "address",
            "public_notes",
            "id",
            "name",
            "hours",
            "vaccinefinder_location_id",
            "vaccinespotter_location_id",
            "google_place_id"
          ],
          "zoom_element": ["hours", "public_notes", "appointment_details"]
        }
      },
      "tiles": {
        "limit": [["lowest_where", true, 2128, "id"]]
      }
    }
  }
}

Tileset layers appearing across zoom levels

Use the new tileset, or the Vaccinate The States public tileset at calltheshots.vaccinatethestates, to build a Style in Mapbox Studio or a web map with GL JS.

Vaccinate The States can use more help. Learn more about volunteering to help call clinics or working on code. We can do this!

No items found.
No items found.

Maps feature data from Mapbox © Mapbox, OpenStreetMap © OpenStreetMap and their data partners, including Maxar (if applicable, © Maxar).

Related articles