ar_redadeg/scripts/create_osm_roads_pgr.sh

41 lines
1 KiB
Bash
Raw Normal View History

#!/bin/bash
2020-02-16 16:13:10 +00:00
set -e
set -u
PSQL=/usr/bin/psql
DB_HOST=localhost
DB_NAME=redadeg
DB_USER=redadeg
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 ""
2020-02-16 16:13:10 +00:00
$PSQL -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT DropTopology('osm_roads_topo') ;"
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 ""