ar_redadeg/scripts/create_osm_roads_pgr.sh

45 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
2020-02-16 16:13:10 +00:00
set -e
set -u
# argument 1 = millesime redadeg
millesime=$1
2020-02-16 16:13:10 +00:00
PSQL=/usr/bin/psql
DB_HOST=localhost
DB_NAME=redadeg_$millesime
2020-02-16 16:13:10 +00:00
DB_USER=redadeg
DB_PASSWD=redadeg
2020-02-16 16:13:10 +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 ""
$PSQL -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT DropTopology('osm_roads_topo') ;" || true
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);"
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');"
echo ""
echo "fait"
echo ""
echo "fini >> exécuter update_osm_roads_pgr.sh "
echo ""