Wrapper for downloading and processing Cartography Boundaries from the US Census Bureau
Project description
census-cb
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()
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for census_cb-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 930c1c3a748d94a466345305645687df825ca2f54666ab9eff83720fb9e2bd11 |
|
MD5 | 5e745d52218854fd05dd48845e6f5983 |
|
BLAKE2b-256 | cae38434e13db4a629321a45e227a0ecc821718e6e8a2208f54eedff9ab355d3 |