Copy from stdin (cat user-accessible file) when loading geometries

This commit is contained in:
Tom Russell 2018-09-30 21:23:19 +01:00
parent 88e054ff55
commit 79724cc449
2 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ gdf_to_save.rename(
)
# convert to CSV
test_data_csv = str(os.path.join(test_dir, 'test_buildings.csv'))
test_data_csv = str(os.path.join(test_dir, 'test_buildings.3857.csv'))
subprocess.run(["rm", test_data_csv])
subprocess.run(["ogr2ogr", "-f", "CSV", test_data_csv, test_data_geojson, "-lco", "GEOMETRY=AS_WKT"])

View File

@ -15,9 +15,9 @@ mastermap_dir=$1
# geom: <geom>
#
find $mastermap_dir -type f -name '*.3857.csv' \
-printf "COPY geometries ( geometry_geom, source_id ) FROM '$mastermap_dir/%f' WITH CSV HEADER;\n" | \
-printf "$mastermap_dir/%f\n" | \
parallel \
psql -c {}
cat {} | psql -c "COPY geometries ( geometry_geom, source_id ) FROM stdin WITH CSV HEADER;"
#
# Delete any duplicated geometries (by TOID)