This is a modified version of Code for America's US Census Area API that checks only against the US Census block group geometries. During (and possibly after) the US government shutdown, it will be used as a replacement for the FCC's Block Conversion API (cached), which provides data describing which Census areas (including a block-level FIPS code) intersect with a given latitude and longitude.
The original README follows:
Simple geospatial API for US Census, in response to the Census Area API hack request.
A sample copy with Bay Area Census data can be found at census-api-bay-area.herokuapp.com.
This is a Flask-based Python application which requires compiled geospatial libraries Shapely and GDAL to run.
- Download and unpack sample Bay Area data.
- Ensure that datasource.shp and other files are located in the same directory as app.py.
- Call
python app.py
for a test server.
To run a more robust installation using the Python WSGI HTTP server Gunicorn, prepare local data as in steps 1 & 2 above, then call:
gunicorn app:app
Compiled geospatial libraries for Heroku are available via the open source GIS Heroku buildpack. There are two possible ways to run this API on Heroku:
-
Fork this repository, download and commit your own data as datasource.shp, and push the combined application + data repository to Heroku.
-
Use the
ZIPPED_DATA_URL
support in heroku-buildpack-pygeo to configure a remote zip file such as bay-area-data.zip (URL linked above), making sure to install the Heroku plugin user-env-compile. Data will be automatically retrieved and expanded to datasource.shp at compile time.