-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
145 changed files
with
11,281 additions
and
8,905 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
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 |
---|---|---|
@@ -1,16 +1,47 @@ | ||
#!/bin/sh | ||
|
||
URL='vector-data-raw/vizzuality_processed_data/analysis_data/eez_minus_mpa.zip' | ||
# Upload the data to the database | ||
# Usage: init.sh [OPTION] | ||
for arg in "$@" | ||
do | ||
case $arg in | ||
eez) | ||
echo "uploading eez_minus_mpa" | ||
URL='vector-data-raw/vizzuality_processed_data/analysis_data/eez_minus_mpa.zip' | ||
TABLE_NAME='eez_minus_mpa' | ||
;; | ||
gadm) | ||
echo "uploading gadm_minus_pa" | ||
URL='vector-data-raw/vizzuality_processed_data/analysis_data/gadm_minus_pa.zip' | ||
TABLE_NAME='gadm_minus_pa' | ||
;; | ||
--help) | ||
echo "Usage: init.sh [OPTION]" | ||
echo "Upload the data to the database" | ||
echo "" | ||
echo "Options:" | ||
echo " --eez Upload eez_minus_mpa data" | ||
echo " --gadm Upload gadm_minus_pa data" | ||
echo " --help Display this help message" | ||
exit 0 | ||
;; | ||
*) | ||
echo "Invalid option $arg" | ||
exit 1 | ||
;; | ||
esac | ||
ogr2ogr --version | ||
|
||
ogr2ogr -progress \ | ||
-makevalid -overwrite \ | ||
-nln eez_minus_mpa -nlt PROMOTE_TO_MULTI \ | ||
-lco GEOMETRY_NAME=the_geom \ | ||
-lco PRECISION=FALSE \ | ||
-lco SPATIAL_INDEX=GIST \ | ||
-lco FID=id \ | ||
-t_srs EPSG:4326 -a_srs EPSG:4326 \ | ||
-f PostgreSQL PG:"host=$POSTGRES_HOST port=$POSTGRES_PORT \ | ||
user=$POSTGRES_USER password=$POSTGRES_PASSWORD \ | ||
dbname=$POSTGRES_DB active_schema=$POSTGRES_SCHEMA" \ | ||
-doo "PRELUDE_STATEMENTS=CREATE SCHEMA IF NOT EXISTS $POSTGRES_SCHEMA AUTHORIZATION CURRENT_USER;" "/vsizip/vsigs/$URL"; | ||
-makevalid -overwrite \ | ||
-nln $TABLE_NAME -nlt PROMOTE_TO_MULTI \ | ||
-lco GEOMETRY_NAME=the_geom \ | ||
-lco PRECISION=FALSE \ | ||
-lco SPATIAL_INDEX=GIST \ | ||
-lco FID=id \ | ||
-t_srs EPSG:4326 \ | ||
-f PostgreSQL PG:"host=$POSTGRES_HOST port=$POSTGRES_PORT \ | ||
user=$POSTGRES_USER password=$POSTGRES_PASSWORD \ | ||
dbname=$POSTGRES_DB active_schema=$POSTGRES_SCHEMA" \ | ||
-doo "PRELUDE_STATEMENTS=CREATE SCHEMA IF NOT EXISTS $POSTGRES_SCHEMA AUTHORIZATION CURRENT_USER;" "/vsizip/vsigs/$URL"; | ||
|
||
done |
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
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
Oops, something went wrong.