A basic script for uploading data to Mapbox. Read more about the Tilesets API in the online documentation.
The uploadData.js
script combines all the steps needed to create a working tileset. To use it, ensure you have configured your environment with a secret token that has tilesets scopes. This can be done by editing the sample.env
file in the top-level project directory and saving it as .env
. The top-level node scripts will copy the .env
file into this directory.
MAPBOX_USERNAME=your-username
MAPBOX_ACCESS_TOKEN=sk.your-secret-token-hash
To make a tileset with that script using default options and sample data, run the following command (it is defined in package.json).
npm run upload-data
The upload script performs the following steps:
- Upload data as a tileset source
- Upload the recipe to create a tileset
- Publish the Tileset defined by the recipe
For more comprehensive tileset management, you can use the Tilesets CLI.
The sample data in this directory is used by the server and the upload scripts.
To create the county data, we correlated 500k cartographic boundary data with the 2018 state FIPS codes. Both data sets are sourced from the US Census website.
The animation sequence data was generated with data from the MIT elections lab, the American Community Survey, and Natural Earth. It combines voter turnout and population data so we can see where participation is high and low across the country.
Source data is available under the licenses described in the following table:
Data | Source | License |
---|---|---|
500k county boundaries | US Census Bureau TIGER | Public Domain |
County FIPS codes | US Census Bureau | Public Domain |
U.S. President 1976–2016 | MIT Election Data and Science Lab | CC0 - "Public Domain Dedication" |
American Community Survey Population Estimates 2016 | US Census Bureau | Public Domain |
Natural Earth time zones | Natural Earth | Public Domain Dedication |
The data in this directory is available under the CC0 - "Public Domain Dedication".
Recommended citation:
Mapbox Solutions Architecture, 2019, "US counties with state names", https://www.mapbox.com/solutions/real-time-maps
The code in this directory is available under the BSD-3-Clause license.