From 2163dc58129f03b43fd7316368dfee2ecb68ff2f Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Tue, 29 Mar 2022 14:48:27 +0100 Subject: [PATCH] add echos to load geometries --- etl/load_geometries.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/etl/load_geometries.sh b/etl/load_geometries.sh index 4a4d5745..a2febe8b 100755 --- a/etl/load_geometries.sh +++ b/etl/load_geometries.sh @@ -1,27 +1,25 @@ #!/usr/bin/env bash -# # Load geometries from GeoJSON to Postgres # - assume postgres connection details are set in the environment using PGUSER, PGHOST etc. -# + : ${1?"Usage: $0 ./path/to/mastermap/dir"} mastermap_dir=$1 -# # Create 'geometry' record with # id: , # source_id: , # geom: -# + +echo "Copy geometries to db..." find $mastermap_dir -type f -name '*.3857.csv' \ -printf "$mastermap_dir/%f\n" | \ parallel \ cat {} '|' psql -c "\"COPY geometries ( geometry_geom, source_id ) FROM stdin WITH CSV HEADER;\"" -# # Delete any duplicated geometries (by TOID) -# +echo "Delete duplicate geometries..." psql -c "DELETE FROM geometries a USING ( SELECT MIN(ctid) as ctid, source_id FROM geometries