From a84d63fa585f2a9e3c729771797957504c3bd44d Mon Sep 17 00:00:00 2001 From: Mael REBOUX Date: Sat, 15 Feb 2020 11:10:23 +0100 Subject: [PATCH] =?UTF-8?q?homog=C3=A9n=C3=A9isation=20upload=20vers=20ser?= =?UTF-8?q?veur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/traitements_phase_1.sh | 43 ++++++++++++++++++++++++++++++++++ scripts/traitements_phase_2.sh | 11 +++++++-- scripts/traitements_phase_3.sh | 31 +++++++++++++----------- 3 files changed, 69 insertions(+), 16 deletions(-) diff --git a/scripts/traitements_phase_1.sh b/scripts/traitements_phase_1.sh index 7facaaf..d9f4c7e 100755 --- a/scripts/traitements_phase_1.sh +++ b/scripts/traitements_phase_1.sh @@ -5,11 +5,17 @@ # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # on récupère les couches geojson depuis umap + +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo " Récupération des fichiers geojson depuis umap" + # le tracé manuel curl -sS http://umap.openstreetmap.fr/fr/datalayer/746021/ > data/phase_1_umap_trace.geojson # PK VIP curl -sS http://umap.openstreetmap.fr/fr/datalayer/715179/ > data/phase_1_umap_pk_vip.geojson +echo " fait" +echo "" # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # on charge dans postgis @@ -17,16 +23,36 @@ curl -sS http://umap.openstreetmap.fr/fr/datalayer/715179/ > data/phase_1_umap_ # note : les coordonnées sont en 3857 mais la déclaration de la table = 4326 +echo " chargement des fichiers dans la BD" +echo "" + psql -U redadeg -d redadeg -c "DROP TABLE phase_1_trace_3857 CASCADE;" ogr2ogr -f "PostgreSQL" PG:"host=localhost user=redadeg password=redadeg dbname=redadeg" data/phase_1_umap_trace.geojson -nln phase_1_trace_3857 -lco GEOMETRY_NAME=the_geom -explodecollections -overwrite psql -U redadeg -d redadeg -c "DROP TABLE phase_1_pk_vip_3857;" ogr2ogr -f "PostgreSQL" PG:"host=localhost user=redadeg password=redadeg dbname=redadeg" data/phase_1_umap_pk_vip.geojson -nln phase_1_pk_vip_3857 -lco GEOMETRY_NAME=the_geom -explodecollections -overwrite +echo " fait" +echo "" + + +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo " Application des traitements SQL " +echo "" # on crée les tables en 3948 psql -U redadeg -d redadeg < traitements_phase_1.sql +echo " fait" +echo "" + + +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo " Exports et upload vers le serveur de diffusion" +echo "" + +echo " exports geojson" +echo "" # et on exporte vers Geojson rm data/phase_1_pk_auto.geojson @@ -39,3 +65,20 @@ ogr2ogr -f "GeoJSON" data/phase_1_trace_4326.geojson PG:"host=localhost user=red rm data/phase_1_pk_auto.xlsx ogr2ogr -f "XLSX" data/phase_1_pk_auto.xlsx PG:"host=localhost user=redadeg password=redadeg dbname=redadeg" phase_1_pk_auto_4326 +echo " fait" +echo "" +echo " upload" +echo "" + +# upload +rsync -av -z data/phase_1_pk_auto.geojson data/phase_1_trace_4326.geojson data/phase_1_pk_auto.xlsx breizhpovh2:/data/www/vhosts/ar-redadeg_openstreetmap_bzh/htdocs/scripts/data/ + +echo " fait" +echo "" + +echo "" +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo " F I N traitements phase 1" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" diff --git a/scripts/traitements_phase_2.sh b/scripts/traitements_phase_2.sh index 76b2509..5f2ca8b 100755 --- a/scripts/traitements_phase_2.sh +++ b/scripts/traitements_phase_2.sh @@ -224,7 +224,7 @@ $PSQL -U $DB_USER -d $DB_NAME < traitements_phase_2.2.sql # et on exporte en geojson pour umap echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" -echo " Exports" +echo " Exports et upload vers le serveur de diffusion" echo "" echo " exports geojson" @@ -250,11 +250,18 @@ ogr2ogr -f "CSV" data/phase_2_tdb.csv PG:"host=localhost user=redadeg password=r echo " fait" echo "" +echo " upload" +echo "" +# upload +rsync -av -z data/phase_2_pk_secteur.geojson data/phase_2_trace_pgr.geojson data/phase_2_trace_secteur.geojson data/phase_2_tdb.xlsx data/phase_2_tdb.csv breizhpovh2:/data/www/vhosts/ar-redadeg_openstreetmap_bzh/htdocs/scripts/data/ + +echo " fait" +echo "" echo "" echo "" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" -echo " F I N" +echo " F I N traitements phase 2" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "" diff --git a/scripts/traitements_phase_3.sh b/scripts/traitements_phase_3.sh index 054f8e5..f3e73c2 100755 --- a/scripts/traitements_phase_3.sh +++ b/scripts/traitements_phase_3.sh @@ -29,32 +29,35 @@ echo "" # et on exporte en geojson pour umap echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" -echo " Exports" +echo " Exports et upload vers le serveur de diffusion" echo "" echo " exports geojson" echo "" -#rm data/phase_3_pk_auto.geojson -#ogr2ogr -f "GeoJSON" data/phase_3_pk_auto.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_pk_auto_4326 -#rm data/phase_3_pk_sens_verif.geojson -#ogr2ogr -f "GeoJSON" data/phase_3_pk_sens_verif.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_pk_sens_verif_4326 -#rm data/phase_3_trace_troncons.geojson -#ogr2ogr -f "GeoJSON" data/phase_3_trace_troncons.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_trace_troncons_4326 -#rm data/phase_3_trace_secteurs.geojson -#ogr2ogr -f "GeoJSON" data/phase_3_trace_secteurs.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_trace_secteurs_4326 +rm data/phase_3_pk_auto.geojson +ogr2ogr -f "GeoJSON" data/phase_3_pk_auto.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_pk_auto_4326 +rm data/phase_3_pk_sens_verif.geojson +ogr2ogr -f "GeoJSON" data/phase_3_pk_sens_verif.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_pk_sens_verif_4326 +rm data/phase_3_trace_troncons.geojson +ogr2ogr -f "GeoJSON" data/phase_3_trace_troncons.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_trace_troncons_4326 +rm data/phase_3_trace_secteurs.geojson +ogr2ogr -f "GeoJSON" data/phase_3_trace_secteurs.geojson PG:"host=$DB_HOST user=redadeg password=redadeg dbname=redadeg" phase_3_trace_secteurs_4326 +echo " fait" +echo "" +echo " upload" +echo "" + +# upload +rsync -av -z data/phase_3_*.geojson breizhpovh2:/data/www/vhosts/ar-redadeg_openstreetmap_bzh/htdocs/scripts/data/ echo " fait" echo "" - -rsync -av -z data/phase_3_*.geojson breizhpovh2:/data/www/vhosts/ar-redadeg_openstreetmap_bzh/htdocs/scripts/data/ - - echo "" echo "" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" -echo " F I N" +echo " F I N traitements phase 3" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo ""