2019-05-09 08:06:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-02-16 16:13:10 +00:00
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
2021-04-16 13:16:47 +00:00
|
|
|
# argument 1 = millesime redadeg
|
|
|
|
millesime=$1
|
|
|
|
|
2020-02-16 16:13:10 +00:00
|
|
|
PSQL=/usr/bin/psql
|
|
|
|
DB_HOST=localhost
|
2021-04-16 13:16:47 +00:00
|
|
|
DB_NAME=redadeg_$millesime
|
2020-02-16 16:13:10 +00:00
|
|
|
DB_USER=redadeg
|
2021-04-16 13:16:47 +00:00
|
|
|
DB_PASSWD=redadeg
|
2020-02-16 16:13:10 +00:00
|
|
|
|
2019-05-09 08:06:54 +00:00
|
|
|
|
|
|
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
echo " Création de la couche osm_roads_pgr"
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# suppose le le .pgpass est correctement configuré pour le compte qui lance ce script
|
|
|
|
|
|
|
|
|
|
|
|
echo ">> suppression de la topologie existante"
|
|
|
|
echo ""
|
2021-04-16 13:16:47 +00:00
|
|
|
$PSQL -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT DropTopology('osm_roads_topo') ;" || true
|
2019-05-09 08:06:54 +00:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
# création d'un schéma qui va accueillir le réseau topologique de la couche osm_roads
|
|
|
|
echo ">> création d'une nouvelle topologie"
|
|
|
|
echo ""
|
2020-02-16 16:13:10 +00:00
|
|
|
$PSQL -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT topology.CreateTopology('osm_roads_topo', 2154);"
|
2019-05-09 08:06:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
echo ">> ajout d'un nouvel attribut sur la table osm_roads"
|
|
|
|
echo ""
|
2020-02-16 16:13:10 +00:00
|
|
|
$PSQL -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT topology.AddTopoGeometryColumn('osm_roads_topo', 'public', 'osm_roads', 'topo_geom', 'LINESTRING');"
|
2019-05-09 08:06:54 +00:00
|
|
|
echo ""
|
|
|
|
echo "fait"
|
|
|
|
echo ""
|
|
|
|
|
2019-05-09 13:17:06 +00:00
|
|
|
|
2019-05-09 08:06:54 +00:00
|
|
|
echo "fini >> exécuter update_osm_roads_pgr.sh "
|
|
|
|
echo ""
|