clarify pre-rquisites and link to doc

This commit is contained in:
Ed Chalstrey 2022-03-09 11:48:45 +00:00
parent a12d49ce54
commit 48fd7ec67f
2 changed files with 18 additions and 17 deletions

View File

@ -230,8 +230,12 @@ npm install
## :house: Loading the building data
There are several ways to create the Colouring London database in your environment. The simplest way if you are just trying out the application would be to use test data from OSM, but otherwise you should follow one of the instructions below to create the full database either from scratch, or from a previously made db (via a dump file).
To create the full database from scratch, follow [these instructions](../etl/README.md), otherwise choose one of the following:
<details>
<summary> With a database dump </summary><p></p>
<summary> Create database from dump </summary><p></p>
If you are a developer on the Colouring London project (or another Colouring Cities project), you may have a production database (or staging etc) that you wish to duplicate in your development environment.
@ -261,7 +265,7 @@ ls ~/colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration;
</details>
<details>
<summary> With test data </summary><p></p>
<summary> Create database with test data </summary><p></p>
This section shows how to load test buildings into the application from OpenStreetMaps (OSM).

View File

@ -1,4 +1,6 @@
# Data loading
# Creating a Colouring London database from scratch
## Data loading
The scripts in this directory are used to extract, transform and load (ETL) the core datasets
for Colouring London:
@ -8,20 +10,13 @@ for Colouring London:
## Prerequisites
Install PostgreSQL and create a database for colouringlondon, with a database
user that can connect to it. The [PostgreSQL
documentation](https://www.postgresql.org/docs/12/tutorial-start.html) covers
installation and getting started.
You should already have set up PostgreSQL and created a database. Make sure to create environment variables to use `psql` if you haven't already:
Install the [PostGIS extension](https://postgis.net/).
Connect to the colouringlondon database and add the PostGIS, pgcrypto and
pg_trgm extensions:
```sql
create extension postgis;
create extension pgcrypto;
create extension pg_trgm;
```bash
export PGPASSWORD=<pgpassword>
export PGUSER=<username>
export PGHOST=localhost
export PGDATABASE=<colouringlondondb>
```
Create the core database tables:
@ -89,3 +84,5 @@ psql < ../migrations/003.index-buildings.up.sql
## Finally
Run the remaining migrations in `../migrations` to create the rest of the database structure.
# Updating the Colouring London database with new OS data