Back to Mapbox elections

2004-2016 presidential elections tilesets

Ready-to-build tilesets containing US presidential general election returns and demographic data from 2004 to 2016, powered by Mapbox Boundaries.

One way to understand a country is to go beyond individual election results to explore trends and changes throughout the years. To support this type of electoral analysis, we’ve created these tilesets which span the last four presidential elections and use geometries from Mapbox Boundaries to visualize returns and population data at both the county and state levels. These tilesets are available to all users via the "Add tileset by ID" option in Mapbox Studio.

What’s in the tilesets?

We’ve created two pairs of tilesets showcasing results by states and by counties respectively. Each pair includes the shapes’ polygons and points for each level.

Note: The tilesets contain a field for FIPS code that you can use as the unique identifier for a county or state. The `FIPS` field is a string. If you need an integer field for FIPS code (for example, if you need to join it with an integer field in another dataset), the tilesets also contain an `id` field that is an integer version of the corresponding state or county FIPS code. For example, the FIPS code for Alameda county in California is 06001 so the `id` value for Alameda county in the tileset is 6001. Read more about how to work with the feature ids in Mapbox GL JS.

County tileset

The county tileset contains the following properties for the years 2004, 2008, 2012, 2016:

Property Description Type
FIPS County unique identifier string
name County name string
state_abbrev State postal code string
land_area_km2 Surface area in km2 integer
{year}_pop_count Population count integer
{year}_total_votes Total votes integer
{year}_winner "dem"/"rep" string
{year}_mov_count Margin of victory - count integer
{year}_mov_pct Margin of victory - percentage integer
{year}_dem_count Vote count for democratic candidate integer
{year}_rep_count Vote count for republican candidate integer
{year}_oth_count Vote count for other candidate integer
{year}_dem_pct Vote percentage for democratic candidate integer
{year}_rep_pct Vote percentage for republican candidate integer
{year}_oth_pct Vote percentage for other candidates integer

Tileset IDs:

  • mapbox.hist-pres-election-county
  • mapbox.hist-pres-election-county-points

State tileset

The state tileset contains the following properties for the years 2004, 2008, 2012, 2016:

Property Description Type
FIPS State unique identifier string
name State name string
state_abbrev State postal code string
land_area_km2 Surface area in km2 integer
{year}_pop_count Population count integer
{year}_total_votes Total votes integer
{year}_winner "dem"/"rep" string
{year}_mov_count Margin of victory - count integer
{year}_mov_pct Margin of victory - percentage integer
{year}_dem_count Vote count for democratic candidate integer
{year}_rep_count Vote count for republican candidate integer
{year}_oth_count Vote count for other candidate integer
{year}_dem_pct Vote percentage for democratic candidate integer
{year}_rep_pct Vote percentage for republican candidate integer
{year}_oth_pct Vote percentage for other candidates integer

Tileset IDs:

  • mapbox.hist-pres-election-state
  • mapbox.hist-pres-election-state-points

About the data

The shapes for counties and states are powered by Mapbox Boundaries. The county presidential returns for 2004, 2008, 2012, and 2016 are sourced from the MIT Election Data and Science Lab's "County Presidential Elections Returns 2000-2016."

The population data was pulled from the US Census Population Estimates Program. The source file for 2004 and 2008 can be found here and the source file for 2012 and 2016 can be found here.

The state voter turnout data for 2004, 2008, 2012, and 2016 is from The United States Elections Project by Michael P.  McDonald, available under a CC-BY with exception license, and was accessed on January, 23rd 2020. Land area for each county and state are from the US Census 2019 TIGER counties shapefile.

Technical details

To use the tileset, you will need a Mapbox account. Create a style in Mapbox Studio and add a new layer to your style. When selecting the data source for the new layer, use the "Add tileset by ID" option and enter one of the four tileset IDs:

  • mapbox.hist-pres-election-state
  • mapbox.hist-pres-election-state-points
  • mapbox.hist-pres-election-county
  • mapbox.hist-pres-election-county-points

Alternatively, you can add a tileset as a vector tile source directly in your code using Mapbox GL JS or the Mapbox Android SDK.

Example

In this example map we showcase the data available in the tileset using our Storytelling Template.

Read more

Explore tips for analyzing data from the past four presidential elections. Read the Deep dive into our new election tilesets.