ar_redadeg/scripts/traitements_phase_3.sh

85 lines
2.4 KiB
Bash
Raw Normal View History

2019-10-13 12:30:09 +00:00
#!/bin/bash
set -e
set -u
# argument 1 = millesime redadeg
millesime=$1
# linux
#PSQL=/usr/bin/psql
# mac via brew
PSQL=/usr/local/bin/psql
DB_HOST=localhost
DB_PORT=55432
DB_NAME=redadeg_$millesime
2019-10-13 12:30:09 +00:00
DB_USER=redadeg
2020-02-15 10:19:28 +00:00
DB_PASSWD=redadeg
2019-10-13 12:30:09 +00:00
# server bed110
#rep_scripts='/data/projets/ar_redadeg/scripts/'
# mac
rep_scripts='/Volumes/ker/mael/projets/osm_bzh/github/ar_redadeg/scripts'
echo "rep_scripts = $rep_scripts"
# variables liées au millésimes
echo "millesime de travail = $1"
rep_data=../data/$millesime
echo "rep_data = $rep_data"
echo "base de données = $DB_NAME sur $DB_HOST:$DB_PORT"
echo ""
exit 1
2019-10-13 12:30:09 +00:00
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Création des données phase 3"
echo ""
# création des PK auto par découpage des tronçons de la phase 2
/Library/FME/2021.0/fme traitements_phase_3_decoupage.fmw
2019-10-13 12:30:09 +00:00
# en sortie on obtient :
# phase_3_pk_auto = couche de points
# phase_3_pk_sens_verif = couche de ligne direct PK à PK
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# et on exporte en geojson pour umap
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
2020-02-15 10:10:23 +00:00
echo " Exports et upload vers le serveur de diffusion"
2019-10-13 12:30:09 +00:00
echo ""
echo " exports geojson"
echo ""
rm $rep_data/phase_3_pk_auto.geojson
ogr2ogr -f "GeoJSON" $rep_data/phase_3_pk_auto.geojson PG:"host=$DB_HOST user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" phase_3_pk_auto_4326
rm $rep_data/phase_3_pk_sens_verif.geojson
ogr2ogr -f "GeoJSON" $rep_data/phase_3_pk_sens_verif.geojson PG:"host=$DB_HOST user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" phase_3_pk_sens_verif_4326
rm $rep_data/phase_3_trace_troncons.geojson
ogr2ogr -f "GeoJSON" $rep_data/phase_3_trace_troncons.geojson PG:"host=$DB_HOST user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" phase_3_trace_troncons_4326
rm $rep_data/phase_3_trace_secteurs.geojson
ogr2ogr -f "GeoJSON" $rep_data/phase_3_trace_secteurs.geojson PG:"host=$DB_HOST user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" phase_3_trace_secteurs_4326
2019-10-13 12:30:09 +00:00
echo " fait"
echo ""
2020-02-15 10:10:23 +00:00
echo " upload"
echo ""
2019-10-13 12:30:09 +00:00
2020-02-15 10:10:23 +00:00
# upload
rsync -av -z $rep_data/phase_3_*.geojson bed100.bedniverel.bzh:/data/projets/ar_redadeg/data/$millesime/
2019-10-14 21:30:01 +00:00
2020-02-15 10:10:23 +00:00
echo " fait"
echo ""
2019-10-14 21:30:01 +00:00
2019-10-13 12:30:09 +00:00
echo ""
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
2020-02-15 10:10:23 +00:00
echo " F I N traitements phase 3"
2019-10-13 12:30:09 +00:00
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""