colouring-montreal/etl
2019-02-05 13:36:43 +00:00
..
join_building_data Add script to upload conservation areas 2019-01-20 15:29:54 +00:00
check_ab_mm_match.py Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
create_building_records.sh Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
drop_outside_limit.sh Skip altering foreign key restrictions 2018-10-04 19:00:56 +01:00
extract_addressbase.sh Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
extract_mastermap.sh Boundary file not needed in initial extraction 2018-10-04 19:01:17 +01:00
filter_addressbase_csv.py Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
filter_mastermap.py Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
filter_transform_mastermap_for_loading.sh Fix sed quoting 2018-10-03 20:10:27 +01:00
get_test_polygons.py Copy from stdin (cat user-accessible file) when loading geometries 2018-09-30 21:23:19 +01:00
load_geometries.sh Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
load_postcodes.sh Load open postcode data 2019-02-05 13:36:43 +00:00
load_uprns.sh Ensure index exists for uprn link 2018-10-04 21:13:25 +01:00
README.md Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00
requirements.txt Record python packages for etl 2018-09-09 11:34:37 +01:00
run_all.sh Comment sections in etl run script 2018-10-21 20:47:31 +01:00
run_clean.sh Update etl to load UPRNs to table 2018-10-02 21:12:46 +01:00

Data loading

The scripts in this directory are used to extract, transform and load (ETL) the core datasets for Colouring London:

  1. Building geometries, sourced from Ordnance Survey MasterMap (Topography Layer)
  2. Unique Property Reference Numbers (UPRNs), sourced from Ordnance Survey AddressBase

Prerequisites

Before running any of these scripts, you will need the OS data for your area of interest. AddressBase and MasterMap are available directly from Ordnance Survey.

The scripts should be run in the following order:

# extract both datasets
extract_addressbase.sh ./addressbase_dir
extract_mastermap.sh ./mastermap_dir
# filter mastermap ('building' polygons and any others referenced by addressbase)
filter_transform_mastermap_for_loading.sh ./addressbase_dir ./mastermap_dir
# load all building outlines
load_geometries.sh ./mastermap_dir
# index geometries (should be faster after loading)
psql < ../migrations/002.index-geometries.sql
# create a building record per outline
create_building_records.sh
# add UPRNs where they match
load_uprns.py ./addressbase_dir
# index building records
psql < ../migrations/003.index-buildings.sql

To help test the Colouring London application, get_test_polygons.py will attempt to save a small (1.5km²) extract from OpenStreetMap to a format suitable for loading to the database.

In this case, run:

# download test data
get_test_polygons.py
# load all building outlines
load_geometries.sh ./test_data_dir
# index geometries (should be faster after loading)
psql < ../migrations/002.index-geometries.sql
# create a building record per outline
create_building_records.sh
# index building records
psql < ../migrations/002.index-buildings.sql