postgresql

[:it]Importare un file GDB in un database postGIS[:en]Import file GDB to postGIS[:]

[:it]Questa è la sintassi che ho utilizzato per importare un geodatabase ESRI (formato GDB) in un geodatabase Postgis 2.0:

ogr2ogr -f "PostgreSQL" PG:"host=hostname user=username dbname=mydb password=mypwd" mygeodb.gdb/ -a_srs EPSG:3003

Fonte: gdal.org[:en]This is the syntax I used to import an ESRI geodatabase (GDB format) into an existing postGIS database:

ogr2ogr -f "PostgreSQL" PG:"host=hostname user=username dbname=mydb password=mypwd" mygeodb.gdb/ -a_srs EPSG:3003 - overwtrite

Font: gdal.org[:]

PSQL command linePSQL da riga di comando

Below some commands line I used to manage spatial data:

Import shape to postgis

shp2pgsql -s epsg_code -c -g geometry_column -I -t 2D -W LATIN1 shapename schemaname.tablename | psql -h hostname -d mydb -U username

Di seguito alcuni comandi psql che uso per gestire i dati geografici:

Import shape to postgis

shp2pgsql -s epsg_code -c -g geometry_column -I -t 2D -W LATIN1 shapename schemaname.tablename | psql -h hostname -d mydb -U username

Postgis 2.0.0 installation from sourceInstallazione di postgis 2.0.0 da sorgenti

Here you are the procedure I follow to install postgis 2.0.0 from source:

  • compile and install  updating GEOS library  from source;
  • execute “ldconfig” command;
  • execute the command a posted here:
tar xvfz postgis-2.0.0.tar.gz
cd postgis-2.0.0
./configure --with-raster --with-topology --with-gui
make
make install
createdb yourdatabase
createlang plpgsql yourdatabase
psql -d yourdatabase -f postgis.sql
psql -d yourdatabase -f postgis_comments.sql
psql -d yourdatabase -f spatial_ref_sys.sql
psql -d yourdatabase -f rtpostgis.sql
psql -d yourdatabase -f raster_comments.sql
psql -d yourdatabase -f topology/topology.sql
psql -d yourdatabase -f doc/topology_comments.sql

SO: Ubuntu 11.10

Ho appena terminato con successo l’installazione di postgis 2.0.0 da codice sorgente scaricato da qui con la seguente procedura:

  • installazione  delle librerie GEOS aggiornate compilandole dai sorgenti scaricati da qui;
  • esecuzione del comando “ldconfig”;
  • esecuzione della procedura pubblicata qui;
tar xvfz postgis-2.0.0.tar.gz
cd postgis-2.0.0
./configure --with-raster --with-topology --with-gui
make
make install
createdb yourdatabase
createlang plpgsql yourdatabase
psql -d yourdatabase -f postgis.sql
psql -d yourdatabase -f postgis_comments.sql
psql -d yourdatabase -f spatial_ref_sys.sql
psql -d yourdatabase -f rtpostgis.sql
psql -d yourdatabase -f raster_comments.sql
psql -d yourdatabase -f topology/topology.sql
psql -d yourdatabase -f doc/topology_comments.sql

SO: Ubuntu 11.10

Installation and configuration of a geodatabase Installazione e configurazione di un database geografico

Procedure:

  1. repository and software installation:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y postgresql-9.0 postgresql-server-dev-9.0 postgresql-contrib-9.0 projlibgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-1.8.0 libgdal1-dev build-essential libxml2 libxml2-dev checkinstall
wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gztar zxvf postgis-1.5.3.tar.gz && cd postgis-1.5.3/
sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-1.5.3 --pkgversion 1.5.3-src --default

2. creation of the geodatabase template

sudo su postgrescreatedb --template template0 template_giscreatelang plpgsql template_gis
psql -U postgres -d template_gis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/postgis.sql
psql -U postgres -d postgis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/spatial_ref_sys.sql
psql -U postgres -d postgis -c"select postgis_lib_version();"

4. Creation of the geodatabase and optionally his admin user:

CREATE USER dbuser PASSWORD 'secret';
CREATE DATABASE dbname OWNER dbuser TEMPLATE template_gis
\connect dbname
GRANT ALL ON geometry_columns TO dbuser;
GRANT SELECT ON spatial_ref_sys TO dbuser;

SO: Ubuntu 12.04 LTS 64 bit
Fonts: (Nicolo Rigacci, Simon Tokumine)

1. Installazione software e repository:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y postgresql-9.0 postgresql-server-dev-9.0 postgresql-contrib-9.0 projlibgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-1.8.0 libgdal1-dev build-essential libxml2 libxml2-dev checkinstall
wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gztar zxvf postgis-1.5.3.tar.gz && cd postgis-1.5.3/
sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-1.5.3 --pkgversion 1.5.3-src --default

2. creazione template Database geografico

sudo su postgrescreatedb --template template0 template_giscreatelang plpgsql template_gis
psql -U postgres -d template_gis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/postgis.sql
psql -U postgres -d postgis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/spatial_ref_sys.sql
psql -U postgres -d postgis -c"select postgis_lib_version();"

3. creazione_di_un_database_geografico

A partire dal template creato si crea un database geografico. Per semplicità di amministrazione si crea un utente che sarà proprietario del database:

CREATE USER dbuser PASSWORD 'secret';
CREATE DATABASE dbname OWNER dbuser TEMPLATE template_gis
\connect dbname
GRANT ALL ON geometry_columns TO dbuser;
GRANT SELECT ON spatial_ref_sys TO dbuser;

SO: Ubuntu 12.04 LTS 64 bit
Fonti: (Nicolo Rigacci, Simon Tokumine)

Installing PostgreSQL 8.3.7 on Ubuntu 9.04Installare PostgreSQL 8.3.7 su Ubuntu 9.04

To  install PostgreSQL 8.3.7 I used the .bin file (Installer version Version 8.3.7-1) from the website enterprisedb:

  1. Convert the .bin file into an executable one with the command: ‘sudo chmod +x nomefile.bin’
  2. Follow the installation instructions
  3. Postgis 1.3.5 can be installed with  ‘Application stack builder’

Per installare PostgreSQL 8.3.7 ho utilizzato il file .bin (Installer version Version 8.3.7-1) dal sito di enterprisedb:

  1. Rendere il file eseguibile con il comando: ‘sudo chmod +x nomefile.bin’
  2. Seguire le istruzioni di installazione
  3. Installare Postgis 1.3.5 attraverso ‘Application stack builder’