Skip to main content

Unofficial Python Binding for the Census Geocoder API

Project description

(Unofficial) Python Binding for the US Census Geocoder API

The US Census Geocoder is a Python library that provides Python bindings for the U.S. Census Geocoder API. It enables you to use simple Python function calls to retrieve Python object representations of geographic meta-data for the addresses or coordinates that you are searching for.

COMPLETE DOCUMENTATION: https://census_geocoder.readthedocs.org/en/latest.html


Installation

To install the US Census Geocoder, just execute:

$ pip install census-geocoder

Dependencies

Python 3.x

* Requests v.2.26 or higher

Why the Census Geocoder?

In fulfilling its constitutional and statutory obligations, the US Census Bureau provides extensive data about the United States. They make this data available publicly through their website, through their raw data files, and through their APIs. However, while their public APIs provide great data, they are limited in both tooling and documentation. So to help with that, we’ve created the US Census Geocoder library.

The Census Geocoder library is designed to provide a Pythonic interface for interacting with the Census Bureau’s Geocoder API. It is specifically designed to eliminate the scaffolding needed to query the API directly, and provides for simpler and cleaner function calls to return forward geocoding and reverse geocoding information. Furthermore, it exposes Python object representations of the outputs returned by the API making it easy to work with the API’s data in your applications.

Key US Census Geocoder Features

  • Easy to adopt. Just install and import the library, and you can be forward geocoding and reverse geocoding with just two lines of code.

  • Extensive documentation. One of the main limitations of the Geocoder API is that its documentation is scattered across the different datasets released by the Census Bureau, making it hard to navigate and understand. We’ve tried to fix that.

  • Location Search

    • Using Geographic Coordinates (reverse geocoding)

    • Using a One-line Address

    • Using a Parametrized Address

    • Using Batched Addresses

  • Geography Search

    • Using Geographic Coordinates (reverse geocoding)

    • Using a One-line Address

    • Using a Parametrized Address

    • Using Batched Addresses

  • Supports all available benchmarks, vintages, and layers.

  • Simplified syntax for indicating benchmarks, vintages, and layers.

  • No more hard to interpret field names. The library uses simplified (read: human understandable) names for location and geography properties.


Hello World and Basic Usage

1. Import the Census Geocoder

import census_geocoder as geocoder

2. Execute a Coding Request

Using a One-line Address

location = geocoder.location.from_address('4600 Silver Hill Rd, Washington, DC 20233')

geography = geocoder.geography.from_address('4600 Silver Hill Rd, Washington, DC 20233')

Using a Parametrized Address

location = geocoder.location.from_address(street_1 = '4600 Silver Hill Rd',
                                          city = 'Washington',
                                          state = 'DC',
                                          zip_code = '20233')

geography = geocoder.geography.from_address(street_1 = '4600 Silver Hill Rd',
                                            city = 'Washington',
                                            state = 'DC',
                                            zip_code = '20233')

Using Batched Addresses

# Via a CSV File
location = geocoder.location.from_batch('my-batched-address-file.csv')

geography = geocoder.geography.from_batch('my-batched-address-file.csv')

Using Coordinates

location = geocoder.location.from_coordinates(latitude = 38.845985,
                                              longitude = -76.92744)


geography = geocoder.geography.from_coordinates(latitude = 38.845985,
                                                longitude = -76.92744)

3. Work with the Results

Work with Python Objects

location.matched_addresses[0].address

>> 4600 SILVER HILL RD, WASHINGTON, DC 20233

For detailed documentation, please see the complete documentation


Questions and Issues

You can ask questions and report issues on the project’s Github Issues Page


Contributing

We welcome contributions and pull requests! For more information, please see the Contributor Guide.


Testing

We use TravisCI for our build automation and ReadTheDocs for our documentation.

Detailed information about our test suite and how to run tests locally can be found in our Testing Reference.


License

The Census Geocoder is made available under an MIT License.

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-geocoder-0.1.0.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

census_geocoder-0.1.0-py2.py3-none-any.whl (32.2 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: census-geocoder-0.1.0.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for census-geocoder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d93953304fe311493f1fa2b944d1f64cafcaceafd1a5cb9994b6b7bfd9ae1d9e
MD5 e3aeab98642e7161d03fc1ae819872f3
BLAKE2b-256 deda74930ac0cf264fc3d0b71f1cca9f9cc3d03b953e9aa35de09584e3912715

See more details on using hashes here.

File details

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

File metadata

  • Download URL: census_geocoder-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for census_geocoder-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 baea649afc3a5c6e2105e44893122533e1306e4266cdfab2338750c1b7246866
MD5 5718397f4983ef44c61ced531dfb84b0
BLAKE2b-256 2bce0f27879edfac6c1aa922e9fe946b2dd2a0ed28a2924bc2eccbd6f0bf09ec

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