Skip to content

Commit

Permalink
fix: customizable SRID
Browse files Browse the repository at this point in the history
  • Loading branch information
lpofredc committed Apr 6, 2021
1 parent d2fbb5f commit d8fe7b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions 07_update_synthese_extended.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ DECLARE
the_altitude_min integer;
the_altitude_max integer;
_the_geom_4326 GEOMETRY(Geometry, 4326);
_the_geom_point GEOMETRY(point, 4326);
_the_geom_local GEOMETRY(Geometry, 2154);
_the_geom_point GEOMETRY(Point, 4326);
_the_geom_local GEOMETRY(Geometry, dbSrid);
the_date_min timestamp;
the_date_max timestamp;
the_validation_comment text;
Expand Down Expand Up @@ -215,7 +215,7 @@ BEGIN
SELECT
_the_geom_4326 INTO _the_geom_point;
SELECT
public.st_transform (_the_geom_4326, 2154) INTO _the_geom_local;
public.st_transform (_the_geom_4326, dbSrid) INTO _the_geom_local;
SELECT
to_timestamp(CAST(NEW.item #>> '{date,@timestamp}' AS double precision)) INTO the_date_min;
SELECT
Expand Down
3 changes: 2 additions & 1 deletion settings.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ dbPort=5432
dbName=mydb
dbUser=mydbuser
dbPwd=mydbuserpwd
dbSrid=2154

# Customization
schemaSource=import_vn
schemaSource=src_vn_json
schemaDestination=src_myowndata


8 changes: 2 additions & 6 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,12 @@ echo -e "\e[1;32m[X]\e[0m compile sql files to tmp/ subdir" | tee -a $logFile
cp *.sql tmp/ | tee -a $logFile
# find . -type f -exec sed "s/src_lpodatas/$schemaName/g" {} \;

cd ./tmp | tee -a $logFile
ls | tee -a $logFile
echo -e "\e[1;32m[X]\e[0m workdir is $(pwd)" | tee -a $logFile
echo -e "\e[1;32m[X]\e[0m source schema name updated to ${schemaSource:-src_vn_json}" | tee -a $logFile
find tmp/ -type f -name "*.sql" -print0 | xargs -0 sed -i "s/src_vn_json/${schemaSource:-src_vn_json}/g"
echo -e "\e[1;32m[X]\e[0m source schema name updated to ${schemaSource:-src_vn_json}" | tee -a $logFile

find tmp/ -type f -name "*.sql" -print0 | xargs -0 sed -i "s/src_lpodatas/${schemaDestination:-src_lpodatas}/g"
echo -e "\e[1;32m[X]\e[0m destination schema name updated to ${schemaDestination:-src_lpodatas}" | tee -a $logFile

find tmp/ -type f -name "*.sql" -print0 | xargs -0 sed -i "s/dbSrid/${dbSrid:-2154}/g"
echo -e "\e[1;32m[X]\e[0m main SRID updated to ${dbSrid:-2154}" | tee -a $logFile
find tmp/ -type f -name "*.sql" -print0 | xargs -0 sed -i "s/geonatadmin/$dbUser/g"
echo -e "\e[1;32m[X]\e[0m db username updated to $dbUser" | tee -a $logFile

Expand Down

0 comments on commit d8fe7b9

Please sign in to comment.