Skip to content

Commit

Permalink
feat: can deactivate nlt param
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed May 23, 2024
1 parent e94c39d commit a7cbcfa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ The `vrt.sh` script is meant to be called regularly via a Cronjob (every 5 hours
or more, as the datasets will be downloaded and published again at each run),
with the previous variables defined.

## Optional variables

The following environment variables are optional:

```
# export ACTIVATE_GEOMETRY_TYPE=false
True by default
```


# Docker

The provided `Dockerfile` is meant to build the `vrt-bot` image, and a build can be
Expand Down
6 changes: 5 additions & 1 deletion vrt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ touch ${SOURCEDIR}/vrtbot.log
then
cd "${SOURCEDIR}"

params=()
if [[ ${ACTIVATE_GEOMETRY_TYPE:-true} == true ]]; then
params=(-nlt PROMOTE_TO_MULTI)
fi
# cycle vrt
for vrt in *.vrt;
do
echo "import de ${SOURCEDIR}/${vrt} dans le schema ${ACTIVESCHEMA} de la base ${PGDATABASE}" | tee -a vrtbot.log
/usr/bin/ogr2ogr \
-f Postgresql \
-overwrite \
PG:"active_schema=${ACTIVESCHEMA}" "${vrt}" -lco SCHEMA=${ACTIVESCHEMA} -lco OVERWRITE=yes -lco GEOMETRY_NAME=geometry -nlt PROMOTE_TO_MULTI -lco DESCRIPTION="import par ${JOB_NAME}/${BUILD_NUMBER} le ${DATE} - ${SOURCEDIR}/${vrt}" 2>&1 | tee -a vrtbot.log
PG:"active_schema=${ACTIVESCHEMA}" "${vrt}" -lco SCHEMA=${ACTIVESCHEMA} -lco OVERWRITE=yes -lco GEOMETRY_NAME=geometry "${params[@]}" -lco DESCRIPTION="import par ${JOB_NAME}/${BUILD_NUMBER} le ${DATE} - ${SOURCEDIR}/${vrt}" 2>&1 | tee -a vrtbot.log
# post import sql
if [ -f "${vrt}.sql" ]; then
echo "script sql après import trouvé" | tee -a vrtbot.log
Expand Down

0 comments on commit a7cbcfa

Please sign in to comment.