-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hugh Saalmans
committed
Nov 17, 2022
1 parent
1f8d039
commit fc8eb7c
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# need a Python 3.10+ environment with GDAL 3.6.0 and PyArrow | ||
conda deactivate | ||
conda activate geo | ||
|
||
# get the directory this script is running from | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
OUTPUT_FOLDER="/Users/$(whoami)/tmp/gdal-testing" | ||
mkdir -p "${OUTPUT_FOLDER}" | ||
cd "${OUTPUT_FOLDER}" | ||
|
||
|
||
# convert Postgres table to CSV with CSVT field types file | ||
input_schema="gnaf_202208" | ||
input_table="address_principals" | ||
|
||
echo "Exporting ${input_schema}.${input_table}" | ||
|
||
ogr2ogr \ | ||
-f CSV \ | ||
"${OUTPUT_FOLDER}/${input_table}.csv" \ | ||
PG:"host='localhost' dbname='geo' user='postgres' password='password' port='5432'" \ | ||
"${input_schema}.${input_table}(geom)" \ | ||
-lco CREATE_CSVT=YES |