Represent is the open database of Canadian elected representatives and electoral districts. It provides a RESTful API to boundary, representative, and postcode resources.
This repository provides an API to geographic boundaries. It is based on the Chicago Tribune's django-boundaryservice.
The represent-canada repository provides a full sample app, and points to plugins which add representative, postcode, and map features to this boundaries API.
API documentation is available at represent.opennorth.ca/api/.
Install the package:
python setup.py install
Add boundaries
to INSTALLED_APPS in your settings.py.
Add the following to your urls.py:
(r'', include('boundaries.urls')),
Run python manage.py syncdb
(or migrate
if you use South).
By default, shapefiles are expected to be in subdirectories of [project_dir]/data/shapefiles, though this can be configured via the BOUNDARIES_SHAPEFILES_DIR
setting.
To load data, run
python manage.py loadshapefiles
This command loads every file for which it can find a definition. It looks for definitions in files ending with definition.py
or definitions.py
in BOUNDARIES_SHAPEFILE_DIR
or its subdirectories.
See the sample definition in definition.example.py.
Note that it's a good idea to keep DEBUG off during this process or Django will try to remember every SQL command.
The starting point for exploring the API resources is /boundary-sets. From there you'll see references to additional URLs to look at.
Please use GitHub Issues for bug reports. You can also contact [email protected].