2021-09-20 19:53:36 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
# exit dès que qqch se passe mal
|
|
|
|
set -e
|
|
|
|
# sortir si "unbound variable"
|
|
|
|
#set -u
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
echo "Pas de millésime en argument --> stop"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# lecture du fichier de configuration
|
|
|
|
. config.sh
|
|
|
|
|
|
|
|
|
|
|
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
2021-09-20 21:29:08 +00:00
|
|
|
echo " PK secteurs"
|
2021-09-20 19:53:36 +00:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
# on commence par supprimer la table
|
|
|
|
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "DROP TABLE IF EXISTS phase_2_pk_secteur_3857 CASCADE;"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
2021-09-23 20:50:45 +00:00
|
|
|
echo " récupération des fichiers geojson depuis la carte umap"
|
2021-10-03 07:47:20 +00:00
|
|
|
curl -sSk https://umap.openstreetmap.fr/fr/datalayer/1903900/ > $rep_data/phase_2_umap_pk_secteur.geojson
|
2021-09-23 20:50:45 +00:00
|
|
|
echo " fait"
|
|
|
|
echo ""
|
2021-09-20 19:53:36 +00:00
|
|
|
|
2021-09-23 20:50:45 +00:00
|
|
|
# on charge dans postgis
|
|
|
|
# note : les coordonnées sont en 3857 mais la déclaration de la table = 4326
|
2021-09-20 19:53:36 +00:00
|
|
|
|
2021-09-23 20:50:45 +00:00
|
|
|
echo " chargement dans la couche d'import"
|
|
|
|
ogr2ogr -f "PostgreSQL" PG:"host=$DB_HOST port=$DB_PORT user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" \
|
|
|
|
$rep_data/phase_2_umap_pk_secteur.geojson -nln phase_2_pk_secteur_3857 -lco GEOMETRY_NAME=the_geom -explodecollections
|
|
|
|
echo " fait"
|
|
|
|
echo ""
|
2021-09-20 19:53:36 +00:00
|
|
|
|
2021-09-20 21:29:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
echo " Points de nettoyage"
|
2021-09-20 19:53:36 +00:00
|
|
|
echo ""
|
|
|
|
|
2021-09-20 21:29:08 +00:00
|
|
|
# on commence par supprimer la table
|
|
|
|
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "DROP TABLE IF EXISTS phase_2_point_nettoyage_3857 CASCADE;"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo " récupération des fichiers geojson depuis la carte umap"
|
2021-10-03 07:47:20 +00:00
|
|
|
curl -sSk https://umap.openstreetmap.fr/fr/datalayer/1899462/ > $rep_data/phase_2_umap_points_nettoyage.geojson
|
2021-09-20 19:53:36 +00:00
|
|
|
echo " fait"
|
|
|
|
echo ""
|
|
|
|
|
2021-09-20 21:29:08 +00:00
|
|
|
echo " chargement dans la couche d'import"
|
|
|
|
ogr2ogr -f "PostgreSQL" PG:"host=$DB_HOST port=$DB_PORT user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" \
|
|
|
|
$rep_data/phase_2_umap_points_nettoyage.geojson -nln phase_2_point_nettoyage_3857 -lco GEOMETRY_NAME=the_geom -explodecollections
|
|
|
|
echo " fait"
|
|
|
|
echo ""
|
2021-09-20 19:53:36 +00:00
|
|
|
|
2021-09-25 10:16:52 +00:00
|
|
|
|
|
|
|
|
2021-09-20 19:53:36 +00:00
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
2021-10-03 14:05:59 +00:00
|
|
|
echo " F I N récupération des données phase 2"
|
2021-09-20 19:53:36 +00:00
|
|
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
echo ""
|