Introduction
Any spatial question — which districts, which counties, which tracts — needs an
authoritative boundary file before it can be answered, and manually downloading and
converting Census TIGER shapefiles is a chore that derails the actual analysis.
FetchUSShapefile answers "what are the official U.S. Census boundaries for this
geography, and how do I get them as a GeoDataFrame I can plot or join against?" in a
single call, with caching handled underneath. Reach for it whenever a question needs
to be mapped or spatially joined against standard U.S. administrative geography —
redistricting, resource allocation, jurisdiction analysis — rather than sourcing
shapefiles by hand.
TIGER shapefiles are the authoritative source for U.S. Census geographic boundaries and are essential for:
- Demographic and socioeconomic spatial analysis
- Electoral district mapping and redistricting analysis
- Public health surveillance and healthcare resource planning
- Crime mapping and law enforcement jurisdiction analysis
- Educational planning and school district analysis
- Market research and business location intelligence
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
state | | None | Two-letter state abbreviation or full state name for which to fetch the shapefile. Required for most geography types (e.g., counties, tracts) but not for nation-level geographies. |
county | | None | County name for which to fetch the shapefile. Required for fine-grained geographies like census tracts, block groups, and blocks. Ignored for broader geographies. |
geography | | 'census tract' | Type of geographical unit to fetch. Must be one of: 'nation', 'divisions', 'regions', 'states', 'counties', 'zipcodes', 'tract', 'block groups', 'blocks', 'school districts', 'county subdivisions', 'congressional districts', 'state legislative districts', 'voting districts'. |
census_year | | 2021 | Census year for which to fetch the shapefile. Different years may have different boundaries due to redistricting or geographic changes. |
Returns
A geopandas.GeoDataFrame containing the requested geographic boundaries with
associated attributes (FIPS codes, names, etc.) and geometry information.
Example
from analysistoolbox.data_collection import FetchUSShapefile
# Fetch all census tracts for California
tracts_gdf = FetchUSShapefile(
state='CA',
geography='tract',
census_year=2021
)