prise en charge millesime database
This commit is contained in:
parent
abf59743b4
commit
302f85f726
|
@ -3,27 +3,31 @@
|
||||||
|
|
||||||
# utiliser un compte SUPERUSER pour exécuter ce script
|
# utiliser un compte SUPERUSER pour exécuter ce script
|
||||||
|
|
||||||
dbhost=localhost
|
millesime=2022
|
||||||
|
|
||||||
#psql -h $dbhost -d postgres -c "DROP DATABASE IF EXISTS redadeg; DROP ROLE IF EXISTS redadeg;"
|
PSQL=/usr/bin/psql
|
||||||
|
DB_HOST=localhost
|
||||||
|
DB_NAME=redadeg_$millesime
|
||||||
|
|
||||||
|
psql -h $dbhost -d postgres -c "DROP DATABASE IF EXISTS $DB_NAME; DROP ROLE IF EXISTS redadeg;"
|
||||||
|
|
||||||
# create role
|
# create role
|
||||||
psql -h $dbhost -d postgres -c "CREATE USER redadeg WITH PASSWORD 'redadeg' SUPERUSER;"
|
psql -h $dbhost -d postgres -c "CREATE USER redadeg WITH PASSWORD 'redadeg' SUPERUSER;"
|
||||||
|
|
||||||
# create database with owner redadeg
|
# create database with owner redadeg
|
||||||
psql -h $dbhost -d postgres -c "CREATE DATABASE redadeg WITH OWNER = redadeg ENCODING = 'UTF8';"
|
psql -h $dbhost -d postgres -c "CREATE DATABASE $DB_NAME WITH OWNER = redadeg ENCODING = 'UTF8';"
|
||||||
|
|
||||||
# extensions postgis
|
# extensions postgis
|
||||||
psql -h $dbhost -d redadeg -c "CREATE EXTENSION postgis;"
|
psql -h $dbhost -d $DB_NAME -c "CREATE EXTENSION postgis;"
|
||||||
psql -h $dbhost -d redadeg -c "CREATE EXTENSION postgis_topology;"
|
psql -h $dbhost -d $DB_NAME -c "CREATE EXTENSION postgis_topology;"
|
||||||
psql -h $dbhost -d redadeg -c "CREATE EXTENSION pgrouting;"
|
psql -h $dbhost -d $DB_NAME -c "CREATE EXTENSION pgrouting;"
|
||||||
|
|
||||||
# permissions
|
# permissions
|
||||||
psql -h $dbhost -d redadeg -c "ALTER SCHEMA public OWNER TO redadeg;"
|
psql -h $dbhost -d $DB_NAME -c "ALTER SCHEMA public OWNER TO redadeg;"
|
||||||
psql -h $dbhost -d redadeg -c "ALTER TABLE topology.layer OWNER TO redadeg ;"
|
psql -h $dbhost -d $DB_NAME -c "ALTER TABLE topology.layer OWNER TO redadeg ;"
|
||||||
psql -h $dbhost -d redadeg -c "ALTER TABLE topology.topology OWNER TO redadeg ;"
|
psql -h $dbhost -d $DB_NAME -c "ALTER TABLE topology.topology OWNER TO redadeg ;"
|
||||||
|
|
||||||
# vérifications
|
# vérifications
|
||||||
psql -h $dbhost -d redadeg -c "SELECT * FROM postgis_version();"
|
psql -h $dbhost -d $DB_NAME -c "SELECT * FROM postgis_version();"
|
||||||
psql -h $dbhost -d redadeg -c "SELECT * FROM pgr_version();"
|
psql -h $dbhost -d $DB_NAME -c "SELECT * FROM pgr_version();"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ set -u
|
||||||
|
|
||||||
PSQL=/usr/bin/psql
|
PSQL=/usr/bin/psql
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_NAME=redadeg
|
DB_NAME=redadeg_$millesime
|
||||||
DB_USER=redadeg
|
DB_USER=redadeg
|
||||||
DB_PASSWD=redadeg
|
DB_PASSWD=redadeg
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,23 @@
|
||||||
set -e
|
set -e
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
|
millesime=2022
|
||||||
|
|
||||||
PSQL=/usr/bin/psql
|
PSQL=/usr/bin/psql
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_NAME=redadeg
|
DB_NAME=redadeg_$millesime
|
||||||
DB_USER=redadeg
|
DB_USER=redadeg
|
||||||
DB_PASSWD=redadeg
|
DB_PASSWD=redadeg
|
||||||
|
|
||||||
# ce script récupère une couche des communes de France et la charge dans la base de données
|
# ce script récupère une couche des communes de France et la charge dans la base de données
|
||||||
|
|
||||||
cd data
|
mkdir -p ../data/$millesime/
|
||||||
|
cd ../data/$millesime/
|
||||||
|
|
||||||
# récupérer la couche communales OSM
|
# récupérer la couche communales OSM
|
||||||
# https://www.data.gouv.fr/fr/datasets/decoupage-administratif-communal-francais-issu-d-openstreetmap/
|
# https://www.data.gouv.fr/fr/datasets/decoupage-administratif-communal-francais-issu-d-openstreetmap/
|
||||||
curl -sS http://osm13.openstreetmap.fr/~cquest/openfla/export/communes-20210101-shp.zip > communes-20210101-shp.zip
|
#curl -sS http://osm13.openstreetmap.fr/~cquest/openfla/export/communes-20210101-shp.zip > communes-20210101-shp.zip
|
||||||
|
wget http://osm13.openstreetmap.fr/~cquest/openfla/export/communes-20210101-shp.zip
|
||||||
|
|
||||||
unzip -o communes-20210101-shp.zip
|
unzip -o communes-20210101-shp.zip
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue