The Boundary Service is a ready-to-deploy system for aggregating regional boundary data (from shapefiles) and republishing that data via a RESTful JSON API. It includes an extensive demo site which demonstrates the functionality of the API using client-side javascript.
This project is aimed at providing a simple service for newsrooms, open-government hackers and others to centralize and build on regional GIS data. You can see the instance we’ve configured for Chicago & Illinois, along with much more detailed information about the API at http://boundaries.tribapps.com/.
To bootstrap the boundary service locally you’ll first need to create a virtualenv and install the requirements. Using virtualenvwrapper that looks like this:
cd boundaryservice mkvirtualenv boundaryservice pip install -r requirements.txt
You’ll need to have postgres running locally, then you can then fast-track through database setup by running:
fab local_bootstrap
Finally, you will need to load some data. The project comes with one example dataset. To load all available datasets you should run:
./manage load_shapefiles
In the future, you can load only specific shapefiles by passing the -o flag with a comma-delimited list of Boundary Sets (whitespace in the the Boundary Set’s names is collapsed). You can also reload boundary sets (clearing existing data) by passing the -c flag. Combine the two flags to clear and reload only specific datasets.
To run the service locally you will need to run two commands in separate terminals, one to run the api and another to run the demo application.
./runapi
./manage runserver
Once those commands are running you should be able to visit http://localhost:8000/ to see the demo site, which will be making AJAX requests to http://localhost:8001/1.0/ for boundary data. To see the API in action try a url such as http://localhost:8001/1.0/boundary-set/.
The Boundary Service is based on the most recent iteration of our newsapps Django project layout, (which is now part of Gareth Rushgrove’s django-project-tempalates). Using this base for a project provides extensive infrastructure for doing robust deployments including isolated configuration, stable branch handling, deployment of static assets to S3, and an extensive fabric deployment script.
Thus, there are three options for deployment:
- Our project template is tightly integrated with our GeoDjango Amazon EC2 image. So for the quickest possible deployment, you can deploy to that image and be up and running very quickly.
- Alternatively, you should be able to modify the appropriate paths in both the relevant configuration files, found in boundaryservice/configs and in fabfile.py to deploy the site to any architecture.
- If neither of those ideas appeal to you, it should be reasonably straight-forward to simply remove the “api” app from this project and migrate it into your own project template. (Note: this will make us cry.)
The Boundary Service is a product of the News Applications team at the Chicago Tribune. Core development was done by Christopher Groskopf and Ryan Nagle.
MIT.