How to access US Census TIGER shapefiles in geopandas?

201 views Asked by At

Context: I have a range of ACS data I work with, and I was looking to plot it at the block group level. However, I am struggling to find the relevant geometry objects to actually make such plots. TIGER files from census (which I think I used back in the early 2010s with geopandas) can't be loaded to gpd, and nowhere in the current TIGER documentation do they mention a data table with a geometry column.

This stands in contrast to numerous example codes online (eg. here and here) that just load TIGER uris into geopandas and implicitly have geometry in the loaded object.

Example code:

import geopandas as gpd
# input vars
state_id = 78
year = 2020
file_type='bg'

# load TIGER from URI
uri = f"https://www2.census.gov/geo/tiger/TIGER{year}/{file_type.upper()}/tl_{year}_{state_id}_{file_type.lower()}.zip"
example_blockgroups = gpd.read_file(uri)

gives TypeError: __init__() missing 1 required keyword-only argument: 'geometry'

As do other very basic loads of TIGER files like

gpd.read_file("https://www2.census.gov/geo/tiger/TIGER2020/STATE/tl_2020_us_state.zip")
gpd.read_file("https://www2.census.gov/geo/tiger/TIGER2017/STATE/tl_2017_us_state.zip")
gpd.read_file("https://www2.census.gov/geo/tiger/TIGER2019/TABBLOCK/tl_2019_01_tabblock10.zip")
0

There are 0 answers