SpeedUpAmerica - Vector Tilesets & Boundaries
The following is an easy-to-use method for converting Census Tract data to Vector Tilesets. 

Requirements

  1. MacOS or a Linux OS Terminal - Will not work on Windows (Use Virtual Machine)
  1. Command Line Tools - GIT, MAKE, G++, LIBSQLITE3-DEV, ZLIB1G-DEV, jq
Linux Commands:
$ sudo apt-get install git make build-essential g++ libsqlite3-dev \
  zlib1g-dev gdal-bin jq
  1. Follow the instructions and install Mapbox - Tippecanoe 

  • Note: Keep Terminal open in the Tippecanoe directory, this will make your life easier

Tileset Creation Steps:

  1. Get the data. Visit https://www2.census.gov/geo/tiger/TIGER2017/TRACT/ and find the corresponding zip. Oregon Census Tract FIPS Code is 41, thus “tl_2017_41_tract.zip”.
  1. Add the full file name to the URL, for example if I want “tl_2017_41_tract.zip”, run the commands:

$ curl -L -O https://www2.census.gov/geo/tiger/TIGER2010/TRACT/2000/tl_2017_41_tract.zip
$ unzip tl_2017_41_tract.zip
$ ogr2ogr -f GeoJSON oregon_41_tracts.shp.json tl_2017_41_tract.shp
$ tippecanoe -zg -o oregon_41_tracts.mbtiles -l oregon_census oregon_41_tracts.shp.json

  • Note: Name the output GeoJSON file (Line 3: oregon_41_tracts.shp.json) to describe the file.

  1. The Vector Tileset file in this example is oregon_41_tracts.mbtiles. 
  1. Success! You can upload this .mbtiles to Mapbox Studio as “New tileset”

You should see the following when you click on your new tileset; the properties are required.

Known Issues when Installing

If at any point you get errors run $ make clean - better to cleanup the directory first and try again
  • $ sudo apt-get install make - will fix make command not found
  • $ sudo apt-get install update; sudo apt-get install build-essentials - install g++ used by the Makefile in Tippecanoe
  • $ sudo apt-get install libsqlite3-dev - sqlite3.h: No such file or directory
  • $ sudo apt install zlib1g-dev - zlib.h: No such file or directory

Boundaries

The new boundaries table is populated using the populate_boundaries rake task. That rake task contains a hash of boundary types to files containing those types. Adding new boundaries is as simple as adding types and files to this hash. 

The files are created from Shapefiles like so:
$ ogr2ogr -f GeoJSON  tl_2018_us_county.shp.json tl_2018_us_county.shp
$ jq -r '.features[] | tostring' tl_2018_us_county.shp.json > tl_2018_us_county.json

Once the files are created upload them the public S3 data bucket, update the buildspec.yml to download the files, and make sure to update the README. Make sure to include an updated dump of the boundaries table in in the PR and update the README.

Useful script

#!/bin/bash

for i in $(seq -f "%02g" 1 56)
do
        curl -L -O https://www2.census.gov/geo/tiger/TIGER2018/TRACT/tl_2018_${i}_tract.zip