Skip to main content

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

Project description

census-cb

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.

Installation

Install using pip

pip install census-cb

Usage

# 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.
cbfp.process_data(bf)

Examples

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_lines.plot()
state_lines.head()

State Boundaries Plot

geometry STATEFP STATENS AFFGEOID GEOID STUSPS NAME LSAD ALAND AWATER
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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file census-cb-0.1.0.tar.gz.

File metadata

  • Download URL: census-cb-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.10

File hashes

Hashes for census-cb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 59533d84a232ef29df24a623478b7d5f3e98a51908ac7280df779c87f0a185bf
MD5 33b2e590b632036a2ea9e4cc25439cc2
BLAKE2b-256 2b9da892192d166a03ad9a9e929cdc889083f57e506d76957a0c8a02ae240383

See more details on using hashes here.

File details

Details for the file census_cb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: census_cb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.10

File hashes

Hashes for census_cb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 930c1c3a748d94a466345305645687df825ca2f54666ab9eff83720fb9e2bd11
MD5 5e745d52218854fd05dd48845e6f5983
BLAKE2b-256 cae38434e13db4a629321a45e227a0ecc821718e6e8a2208f54eedff9ab355d3

See more details on using hashes here.

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