Azioni

PostgreSQL PostGIS

Da MontelLUG WIKI.

How to installare e configurare PostgreSQL e PostGIS su Xubuntu/Ubuntu 11.10 In particolare questa guida fa riferimento alle versioni: PostgreSQL 9.1 PgAdmin3 1.12.3 PostGIS 1.5.3-1

  • Installare PostgrSQL:
   -sudo apt-get install postgresql
  • editare /etc/postgresql/9.1/main/pg_hba.conf
  • Verificare che PostgreSQL funzioni, loggandosi:
   -psql -U postgres

uscire con il comando: \q

  • Installare PgAdmin3
   -sudo apt-get install pgadmin3
  • Installare PostGIS
   -sudo apt-get install postgresql-9.1-postgis
  • Creare link simbolico a shp2pgsql. Servirà per importare i file .shp in PostgreSQL
   -sudo ln -s /usr/lib/postgresql/9.1/bin/shp2pgsql-gui /usr/bin/shp2pgsql-gui

Modificare (o creare se assente), il file plugins.ini come segue. Se state usando pgadmin3 1.14.0, il file dovrebbe andar messo in /usr/share/pgadmin3/plugins.d/ le versioni inferiori lo mettono in /usr/share/pgadmin3/:

   ;
   ; pgShapeLoader (Linux):
   ;
   Title=PostGIS Shapefile and DBF loader
   Command=$$PGBINDIR/shp2pgsql-gui -U $$USERNAME -d $$DATABASE -p $$PORT -h $$HOSTNAME
   Description=Open a PostGIS ESRI Shapefile or Plain dbf loader console to the current database.
   KeyFile=$$PGBINDIR/shp2pgsql-gui
   Platform=unix
   ServerType=postgresql
   Database=Yes
   SetPassword=No

In questo modo avrete l'estensione grafica integrata in PgAdmin3

  • Comandi per creare un database geografico:
   -createdb -U postgres postgisDB
   -createlang -U postgres plpgsql postgisDB
   -psql -U postgres -d postgisDB -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql

D'ora in avanti si può continuare ad usare PgAdmin.