Shapefiles downloader
Python API to download shapefiles from US Census website. Files to be downloaded are selected based on a desired year and shapefiles collection.
If the desired year is not present in the requested collection, the most recent prior year is used.
- class CensusShapeCollection(value)[source]
Collections that are part of the Topologically Integrated Geographic Encoding and Referencing (TIGER) system, a digital database of geographic features, such as roads, rivers, and legal and statistical geographic areas. Each shape file in these collections contains a series of polygons, each corresponding to a specific geographical area.
- genz = 'genz'
TIGER/GENZ collection, most providing simplified representations of selected geographic areas, are specifically designed for small scale thematic mapping and improved visual representations.
- tiger = 'tiger'
TIGER/Line collection, recommended for calculations.
If HTTP Proxy is used the environment variable HTTPS_PROXY must be defined.
Class GISDownloader
- class GISDownloader[source]
Geographic Downloader downloads shape files for given dates from https://www.census.gov/
- COUNTY_TEMPLATE = 'https://www2.census.gov/geo/tiger/GENZ{year}/shp/cb_{year}_us_county_500k.zip'
- ZCTA_GENZ_TEMPLATE = 'https://www2.census.gov/geo/tiger/GENZ{year}/shp/cb_{year}_us_zcta510_500k.zip'
- ZCTA_TIGER_URLs = {2008: 'https://www2.census.gov/geo/tiger/TIGER2008/tl_2008_us_zcta500.zip', 2010: 'https://www2.census.gov/geo/tiger/TIGER2010/ZCTA5/2010/tl_2010_us_zcta510.zip', 2012: 'https://www2.census.gov/geo/tiger/TIGER2012/ZCTA5/tl_2012_us_zcta510.zip', 2013: 'https://www2.census.gov/geo/tiger/TIGER2013/ZCTA5/tl_2013_us_zcta510.zip', 2014: 'https://www2.census.gov/geo/tiger/TIGER2014/ZCTA5/tl_2014_us_zcta510.zip', 2015: 'https://www2.census.gov/geo/tiger/TIGER2015/ZCTA5/tl_2015_us_zcta510.zip', 2016: 'https://www2.census.gov/geo/tiger/TIGER2016/ZCTA5/tl_2016_us_zcta510.zip', 2017: 'https://www2.census.gov/geo/tiger/TIGER2017/ZCTA5/tl_2017_us_zcta510.zip', 2018: 'https://www2.census.gov/geo/tiger/TIGER2018/ZCTA5/tl_2018_us_zcta510.zip', 2019: 'https://www2.census.gov/geo/tiger/TIGER2019/ZCTA5/tl_2019_us_zcta510.zip', 2020: 'https://www2.census.gov/geo/tiger/TIGER2020/ZCTA520/tl_2020_us_zcta520.zip', 2021: 'https://www2.census.gov/geo/tiger/TIGER2021/ZCTA520/tl_2021_us_zcta520.zip', 2022: 'https://www2.census.gov/geo/tiger/TIGER2022/ZCTA520/tl_2022_us_zcta520.zip'}
- classmethod download_shapes(source: CensusShapeCollection, year: int, output_dir: Optional[str] = None, strict: bool = False) None [source]
- classmethod download_zcta(source: CensusShapeCollection, year: int, output_dir: Optional[str] = None, strict: bool = False) None [source]
- classmethod download_county(year: int, output_dir: Optional[str] = None, strict: bool = False) None [source]
- y = 2022