Tiling thousands of points to Vaccinate the States

Guest

Guest

May 20, 2021

Tiling thousands of points to Vaccinate the States

Guest

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!

Heading 1

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 2

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 4

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 5

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Heading 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

response = requests.get(

  "https://api.mapbox.com/v4/mapbox.temperature-raster-tileset/tilequery/40,-105.json",

    params={

        "layers": "temperature,wind_speed",

        "bands": "1708304400,1708311600",

    },

Optional caption
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod maximus porta. Pellentesque vitae augue elit. Nam semper eros leo, nec hendrerit nunc aliquet quis. Morbi ac sapien tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Curabitur porta imperdiet lorem, ut aliquet orci pellentesque quis. Donec magna augue, molestie aliquam enim eu, auctor feugiat metus."

Ordered list

  1. Item 1
  2. Item 2
  3. Item 3

Unordered list

  • Item A
  • Item B
  • Item C

Text link

Bold text

Emphasis

Superscript

Subscript

No items found.
No items found.

Related articles