United Kingdom
Here are the basic instructions to install UK data from OS OpenData, ONSPD, and OSNI Open Data:
-
AREA_SRID in conf/general.yml should be 27700 (as Boundary-Line shapes are in the OSGB projection).
-
Change to the project directory, and create database tables (if you haven’t already done this):
./manage.py migrate
Note if you had already done this but only then changed the AREA_SRID, you will need to
./manage.py migrate mapit zero
and then./manage.py migrate mapit
again to get the right SRID in the database.
We use ONSPD to import all uk postcodes, Boundary-Line to import GB shapes, and OSNI to import NI shapes. Code Point is not used.
-
Download the latest Boundary-Line, ONSPD, and OSNI data from https://parlvid.mysociety.org/os/, and save/unzip into a data directory. You need to unzip the OSNI data twice as it contains zipped folders.
-
Run the following in order (update any data paths as necessary):
Notes:
- All commands with a
--commit
argument can be run without that argument to do a dry run and see what would be imported - Pay attention to the filenames used in the
mapit_UK_import_boundary_line
,mapit_UK_import_osni
andmapit_UK_import_onspd
commands. These are likely to change with newer releases so you’ll have to change the command to refer to the correct filenames. - Pay attention to the
--*-srid
options on themapit_UK_import_osni
command. This refers to the projection that the data was released in and it may change with new releases. If the releases came from the mysociety cache you should find ametadata.json
file in the OSNI folder that contains the SRID for each file. If you obtained new releases yourself you can load the shapefiles in a tool such as qgis to find the SRID yourself. - Many of these commands take options that you may wish to investigate to customise the data imported to your database.
Notes on future releases
What to run when new data is released:
- ONSPD:
mapit_UK_import_onspd
- OSNI: Create a control file,
mapit_UK_import_osni
andmapit_UK_find_parents
. - Boundary-Line: Create a control file,
mapit_UK_import_boundary_line
andmapit_UK_find_parents
.
You can manually increase the generation_high_id
when something is new and
something else isn’t. For example a new Boundary-Line means a new generation
for Great Britain, and you can then increase the Northern Ireland boundaries
manually to be in the new generation and vice-versa for a new OSNI.