Cool Maps on Mapbox

Process

Using Mapbox

Play with Mapbox studio. Components are neat things like labels, but layers are where the action is. Make a layer active, bind it to a dataset, bind the attributes of the dataset to various visible features like fill and extrude, then go to town.

Getting data

Get the shapefile for house districts.

Use geopandas to read the shapefile. Observe that GEOID is the concat of state and district ID. Split-apply-combine the date from house district votes into something unique on GEOID, merge the two together. Write the shapefile.

Put it in Mapbox!

Zip the shapefile contents, upload it as a tileset, use that tileset in your map. EZ PZ.

TODOs

Embed the hosted map somewhere, like this or this.

Use precinct-level data from here! Has county codes!

Use camera controls