Skip to main content

Wrapper for downloading and processing Cartography Boundaries from the US Census Bureau

Project description


PyPI PyPI - Python Version GitHub License Coverage Report Codacy grade

census-cb is a wrapper for downloading and processing Cartography Boundaries from the US Census Bureau. It stands for Census Cartographic Boundaries; apparently that's confusing (but, like most things, it made sense at the time).

The goal of census-cb is to provide an easy way to get GIS information created by the United States Census Bureau. There's a wide variety of cartographic files availbable for download, such as state and county lines, voting district, Tribal subdivisions, and more!

Entity Information

There are a designated set of entities available for download from the census bureau. Each year of available data has a specific set of available entities, and the shape of these entities may change from year to year. You can find a full list pdf of available entities for download on the US Census Bureau site.


Install using pip

pip install census-cb


# Create a Boundary File for the desired entity
bf = BoundaryFile(2020, 'us', 'state', '500k')

# Create a processor for downloading and unpacking the data; this processor will return a GeoDataFrame
cbfp = CBFProcessor('gdf')

# Downloads and extracts the Boundary File.


Download and display the state boudnaries from the US Census Bureau.

# Create a Boundary File for the US State Lines
state_boundary_file = BoundaryFile(2020, 'us', 'state', '500k')

# Create a processor that returns a GeoDataFrame
cbfp = CBFProcessor('gdf')

# Get the Data
state_lines = cbfp.process_data(state_boundary_file)

# See the Data

State Boundaries Plot

0 MULTIPOLYGON (((144.64538 13.23627, 144.64716 ... 66 01802705 0400000US66 66 GU Guam 00 543555847 934337453
1 MULTIPOLYGON (((-94.71830 29.72885, -94.71721 ... 48 01779801 0400000US48 48 TX Texas 00 676680588914 18979352230
2 MULTIPOLYGON (((-86.95617 45.35549, -86.95463 ... 55 01779806 0400000US55 55 WI Wisconsin 00 140292246684 29343721650
3 MULTIPOLYGON (((-71.28802 41.64558, -71.28647 ... 44 01219835 0400000US44 44 RI Rhode Island 00 2677759219 1323691129
4 MULTIPOLYGON (((-72.03683 41.24984, -72.03496 ... 36 01779796 0400000US36 36 NY New York 00 122049520861 19256750161

To Do

  • provide some better functionality for editing Entity Information after a BoundaryFile object is declared.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

census-cb-0.1.0.tar.gz (6.1 kB view hashes)

Uploaded source

Built Distribution

census_cb-0.1.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page