Represent Boundaries is a Django app, which you can deploy on its own or integrate into an existing Django project. Its source code is available on GitHub.

Install dependencies

Represent Boundaries requires Python 2.6, 2.7, 3.3 or 3.4 and PostGIS. Follow GeoDjango’s instructions, or use the quick-start guide for OS X users below.

If you have issues installing dependencies, check GeoDjango’s help section.

Mac OS X

This guide assumes you are using Homebrew as your package manager. If you use MacPorts or Fink, the steps are similar.

  1. Install Xcode
  2. Install Homebrew
  3. Ensure Homebrew is up-to-date:

     brew update
    
  4. Ensure Homebrew is ready to go. Most warnings can be safely ignored:

     brew doctor
    
  5. Install Python 2.7, which will install pip and setuptools:

     brew install python
    
  6. Install GDAL and PostGIS:

     brew install gdal postgis
    
  7. Follow the instructions to start a PostgreSQL server:

     brew info postgresql
    

Install Represent Boundaries

  1. Create a PostGIS database:

     createdb my_database
     psql my_database -c "CREATE EXTENSION postgis;"
    
  2. Install Django, psycopg2 and Represent Boundaries:

     pip install Django psycopg2 represent-boundaries
    
  3. Start a new Django project. Skip this step if you are integrating Represent Boundaries into an existing Django project.

     django-admin.py startproject my_project
     cd my_project
    
  4. In my_project/settings.py, configure the default database to connect to the PostGIS database you created above.

  5. In my_project/settings.py, add these lines to the end of the INSTALLED_APPS list:

     'django.contrib.gis',
     'boundaries',
    
  6. In my_project/urls.py, add this line to the end of the urlpatterns list:

     url('', include('boundaries.urls')),
    
  7. From your project’s directory, run:

     python manage.py migrate
    

You can now run python manage.py runserver and navigate to http://127.0.0.1:8000/boundary-sets/ to see your empty API. Let’s add some data!