The tigerweb Module

tigerweb.py

Code for interacting with the Census TIGERWEb API, query area and download shape

files.

get_area(geometry, sq_mi=True)[source]

Create a data frame of Census GEOIDs and Area. Due to the Tigerweb API’s limiting of the number of features per query to 100,000, block groups aren’t currently supported through this wrapper.

Parameters:
  • geometry – type of census geometry to use

  • sq_mi – Should areas be converted to square miles?

Returns:

pandas data frame

download_geometry(geometry, year=2019, out_dir='.')[source]

Get spatial information for a census geometry in geojson format and save it to disk

Parameters:
  • geometry – type of census geometry to use

  • year – Year to get geometry for

  • out_dir – Directory to save downloaded files in. Note that due to requiring multiple downloads, tract and block group downloads will create a directory if no out_dir is defined.

Returns:

None, downloads files only