Skip to content

Instantly share code, notes, and snippets.

@ismasan
Created November 8, 2013 11:03
Show Gist options
  • Save ismasan/7369487 to your computer and use it in GitHub Desktop.
Save ismasan/7369487 to your computer and use it in GitHub Desktop.

install setuptools

https://pypi.python.org/pypi/setuptools#installation-instructions

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo python ez_setup.py

install pip

sudo easy_install pip

install virtualenv

pip install virtualenv

you might need to

pip install numpy
brew install gdal

install requirements

virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt

# generate the css from the sass
../bin/mapit_make_css

Create DB

pgsql
CREATE DATABASE database_name;

prepare postgres for geo stuff

pgsql database_name
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

# Setup django install
./manage.py syncdb
./manage.py migrate mapit

# run dev server
./manage.py runserver

import data

http://code.mapit.mysociety.org/import/uk/

ok ./manage.py mapit_generation_create --commit --desc "Initial import." ok ./manage.py loaddata uk ok ./manage.py mapit_UK_import_boundary_line
--control=mapit.controls.first-gss --commit
\ls ../data/Boundary-Line/Data/*.shp|\grep -v high_water

(You can run without --commit to do a dry run.)

first-gss in the above assumes the Boundary Line you're importing

is October 2010 or later, and uses the new GSS codes.

./manage.py mapit_UK_find_parents ./manage.py mapit_UK_import_codepoint ../data/Code-Point-Open/*.csv ./manage.py mapit_UK_scilly ../data/Code-Point-Open/tr.csv ./manage.py mapit_UK_import_nspd_ni_areas ./manage.py mapit_UK_import_nspd_ni ../data/ONSPD.csv ./manage.py mapit_UK_import_nspd_crown_dependencies ../data/ONSPD.csv ./manage.py mapit_generation_activate --commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment