Skip to main content

Easily download U.S. census maps

Project description

Easily download U.S. census maps

Installation

$ pipenv install census-map-downloader

Command line usage

Usage: censusmapdownloader [OPTIONS] COMMAND [ARGS]...

  Easily download U.S. census maps

Options:
  --data-dir TEXT  The folder where you want to download the data
  --year INTEGER   The vintage of data to download. By default it gets the
                   latest year. Not all data are available for every year.

  --help           Show this message and exit.

Commands:
  blocks                   Download blocks
  congress-carto           Download cartographic congressional districts
  counties                 Download counties
  counties-carto           Download cartographic counties
  countysubdivision        Download cartographic county subdivisions
  legislative-lower-carto  Download cartographic state legislative...
  legislative-upper-carto  Download cartographic state legislative...
  places                   Download places
  states-carto             Download cartographic states
  tracts                   Download tracts
  zctas                    Download ZCTAs

Examples

Here’s an example of downloading all counties

$ censusmapdownloader counties

You can specify the download directory with –data-dir

$ censusmapdownloader --data-dir ./my-special-folder/ counties

Contributing

Install dependencies for development

$ pipenv install --dev

Run tests

$ make test

Ship new version to PyPI

$ make ship

Adding additional years to a dataset

Downloader classes for different geography types are defined in modules of census_map_downloader.geotypes. For example, the downloader for counties is census_map_downloader.geotypes.counties.CountiesDownloader.

If the URL and fields in a shapefile are the same as those for years that are already supported, you can just add the year to the YEAR_LIST attribute.

If the fields are the same, but the URL changes between groups of years, add logic to the url property method of the downloader classes to alter the URL based on self.year.

If the fields and URL change from year to year, consider creating classes for each year and delegating to census_map_downloader.geotypes.tracts.TractsDownloader is an example of a class that uses this approach.

Developing the CLI

The command-line interface is implemented using Click and setuptools. To install it locally for development inside your virtual environment, run the following installation command, as prescribed by the Click documentation.

$ pip install --editable .

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-map-downloader-0.1.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

census_map_downloader-0.1.0-py2.py3-none-any.whl (17.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file census-map-downloader-0.1.0.tar.gz.

File metadata

  • Download URL: census-map-downloader-0.1.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for census-map-downloader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f703fb2a3644fa46023bc052b69010ca043e5becbbd5c6aa020f3acd8b6c089
MD5 1f80813800edf09e5a3e7a41df60624c
BLAKE2b-256 db20b2470216604c540b59e55245e4a811e9f5fd7acbfd5f6397a724518856fc

See more details on using hashes here.

File details

Details for the file census_map_downloader-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: census_map_downloader-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for census_map_downloader-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f46dda7bc4544da995f968b5a682e1d766bddac8f3887ea3db2872a46b73a03a
MD5 f8457d25563dd98062efaaa9c8524042
BLAKE2b-256 58420f4b46f10775bc0b7a1c76b25fa5d98fa8d987e8f728833347cdc5cb6e4c

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