Kurs PostGIS für Fortgeschrittene: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
Zeile 15: Zeile 15:
 
Vorbereitungen:
 
Vorbereitungen:
 
* Laptops  
 
* Laptops  
* Installation
+
* Installation (siehe unten)
 
 
Installation of PostgreSQL 9.1 (32bit) then PostGIS 2.0 (experimental 32bit):
 
* [http://geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf General instructions (PDF)]
 
* A. Installation of PostgreSQL 9.1.x ([http://www.enterprisedb.com/products-services-training/pgdownload#windows Windows 32bit]
 
** IMPORTANT! No 64bit Build installieren (auh 64bit-CPU nicht, damit PostGIS 2.0 Experimental funktioniert)
 
** Mittels Stackbuilder anschliessend PostGIS 1.5.x installieren
 
* Installation von PostGIS 2.0 ([http://www.postgis.org/download/windows/experimental.php Windows 32bit], siehe "For PostgreSQL 9.1 (compiled against PostgreSQL 9.1.0...")
 
** Make backup of <<POSTGRE_DIR>>\bin
 
** Unzip ZIP-file
 
** Follow instructions of README... Choose batchfile createpostgis_with_extensions.bat and adapt file paths
 
  
 
== Programm ==
 
== Programm ==
Zeile 54: Zeile 44:
  
 
* tbd.
 
* tbd.
 +
 +
== Installation ==
 +
 +
Installation of PostgreSQL 9.1 (production, 32bit) with PostGIS 1.5 (production), then PostGIS 2.0 Experimental (32bit):
 +
* Step 0: Overview of installation of PostgreSQL 9.1.x and PostGIS 1.5 [http://geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf Instructions (PDF)]
 +
* Step 1: Installation of PostgreSQL 9.1.x ([http://www.enterprisedb.com/products-services-training/pgdownload#windows Download PostgreSQL for Windows 32bit])
 +
** NOTE FOR ALL USERS! Don't choose '64bit Build' - even if 64bit-CPU available (because of PostGIS 2.0 Experimental which is 32bit-only)
 +
** Make a note of the password. If PostgreSQL is used on your own laptop (localhost) and for educational purposes, we uses user 'postgres' with password 'postgres'
 +
* Step 2: PostGIS 1.5 (production, 32bit)
 +
** Use Stackbuilder from PostgreSQL postprocessing step
 +
* Step 3: Installation of PostGIS 2.0 (experimental) ([http://www.postgis.org/download/windows/experimental.php Windows 32bit], see weblink "For PostgreSQL 9.1 (compiled against PostgreSQL 9.1.0...")
 +
** Make a copy of the whole <<POSTGRE_DIR>>\bin to a backup directory since some PostGIS 1.5 executables will be replaced by PostGIS 2.0.
 +
** Unzip ZIP-file of PostGIS 2.0 to an temporary installation directory (=> <<POSTGIS_INSTALL_DIR>> = 'postgis-pg91-binaries-2.0.0svn/').
 +
** Follow instructions of the README file.
 +
** Make a copy of makepostgisdb_using_extensions.bat and edit POSTGIS_INSTALL_DIR to adapt following variables: PGPASSWORD, THEDB, PGINSTALL
 +
** Open a CMD-Shell as administrator (NOTE FOR WINDOWS USERS! Choose cmd.exe from Start menu but run it with right click on it 'Run as administrator'!)
 +
 +
<nowiki>
 +
  REM this is an example of how to create a new db and spatially enable it using CREATE EXTENSION
 +
  set PGPORT=5432
 +
  set PGHOST=localhost
 +
  set PGUSER=postgres
 +
  set PGPASSWORD=postgres
 +
  set THEDB=postgis20_extension
 +
  set PGINSTALL=C:\Program Files (x86)\PostgreSQL\9.1
 +
  set PGADMIN=%PGINSTALL%\pgAdmin III
 +
  set PGBIN=%PGINSTALL%\bin\
 +
  set PGLIB=%PGINSTALL%\lib\
 +
  set POSTGISVER=2.0
 +
  xcopy bin\*.* "%PGBIN%"
 +
  xcopy /I /S bin\postgisgui\* "%PGBIN%\postgisgui"
 +
  xcopy /I plugins.d "%PGADMIN%\plugins.d"
 +
  xcopy lib\*.* "%PGLIB%"
 +
  xcopy share\extension\*.* "%PGINSTALL%\share\extension"
 +
  "%PGBIN%\psql"  -c "CREATE DATABASE %THEDB%"
 +
  "%PGBIN%\psql"  -d "%THEDB%" -c "CREATE EXTENSION postgis;"
 +
  "%PGBIN%\psql"  -d "%THEDB%" -c "CREATE EXTENSION postgis_topology;"
 +
 +
  REM Uncomment the below line if this is a template database
 +
  "%PGBIN%\psql" -d "%THEDB%" -c "UPDATE pg_database SET datistemplate = true WHERE datname = '%THEDB%';GRANT ALL ON geometry_columns TO PUBLIC; GRANT ALL ON spatial_ref_sys TO PUBLIC"
 +
 +
  pause
 +
</nowiki>
  
 
== Tipps und Tricks ==
 
== Tipps und Tricks ==

Version vom 19. Januar 2012, 13:25 Uhr

GISpunkt-Seminar "PostGIS für Fortgeschrittene" (Kürzel Sem_PostGIS_FF).

 Nächste geplante Durchführung: Fr. 20. Januar 2012. Informationen und Anmeldung... (alt)

Nicht zu verwechseln mit GISpunkt-Seminar PostgreSQL für Fortgeschrittene. Siehe auch:

Vorkenntisse:

  • Kurs "Einführung in PostGIS/PostgreSQL", d.h.
  • Kenntnisse von SQL sowie Spatial SQL-Funktionen
  • PostgreSQL Tools (psql, pgadminIII), PostGIS-Tools (shp2pgsql
  • Kenntnisse eines GIS zur Visualisierung und zum Editieren von Geodaten

Vorbereitungen:

  • Laptops
  • Installation (siehe unten)

Programm

  • Voraussetzungen/Repetition (Basis Kurs "Einführung in PostGIS)
  • PostgreSQL-Server Setup Grundlagen: Konfiguration, Tablespaces, Clustering
  • Erweiterte PostgreSQL bzw. "SQL Basics": Views, Triggers
  • PostGIS Topologie
  • PostGIS 3D
  • PostGIS Raster
  • Administrierung (Backup und Statistik), insbes. Extensions (neu in 2.0)
  • Nützliche SQL-Scripts, u.a. Konsistenz-Checks (Geometrie, Topologie)
  • Programmierung von Funktionen und Stored Procedures
  • Performance Optimierung von Geodaten-Typen, Hardware-Fragen (siehe dazu auch den Kurs "PostgreSQL für Fortgeschrittene")
  • Anwendung: Historisierung mit Geodaten-Typen
  • Diskussion weitere Anwendungen
  • Ausblick

Software

Unterlagen/Übungen

  • tbd.

Daten

  • tbd.

Installation

Installation of PostgreSQL 9.1 (production, 32bit) with PostGIS 1.5 (production), then PostGIS 2.0 Experimental (32bit):

  • Step 0: Overview of installation of PostgreSQL 9.1.x and PostGIS 1.5 Instructions (PDF)
  • Step 1: Installation of PostgreSQL 9.1.x (Download PostgreSQL for Windows 32bit)
    • NOTE FOR ALL USERS! Don't choose '64bit Build' - even if 64bit-CPU available (because of PostGIS 2.0 Experimental which is 32bit-only)
    • Make a note of the password. If PostgreSQL is used on your own laptop (localhost) and for educational purposes, we uses user 'postgres' with password 'postgres'
  • Step 2: PostGIS 1.5 (production, 32bit)
    • Use Stackbuilder from PostgreSQL postprocessing step
  • Step 3: Installation of PostGIS 2.0 (experimental) (Windows 32bit, see weblink "For PostgreSQL 9.1 (compiled against PostgreSQL 9.1.0...")
    • Make a copy of the whole <<POSTGRE_DIR>>\bin to a backup directory since some PostGIS 1.5 executables will be replaced by PostGIS 2.0.
    • Unzip ZIP-file of PostGIS 2.0 to an temporary installation directory (=> <<POSTGIS_INSTALL_DIR>> = 'postgis-pg91-binaries-2.0.0svn/').
    • Follow instructions of the README file.
    • Make a copy of makepostgisdb_using_extensions.bat and edit POSTGIS_INSTALL_DIR to adapt following variables: PGPASSWORD, THEDB, PGINSTALL
    • Open a CMD-Shell as administrator (NOTE FOR WINDOWS USERS! Choose cmd.exe from Start menu but run it with right click on it 'Run as administrator'!)

REM this is an example of how to create a new db and spatially enable it using CREATE EXTENSION set PGPORT=5432 set PGHOST=localhost set PGUSER=postgres set PGPASSWORD=postgres set THEDB=postgis20_extension set PGINSTALL=C:\Program Files (x86)\PostgreSQL\9.1 set PGADMIN=%PGINSTALL%\pgAdmin III set PGBIN=%PGINSTALL%\bin\ set PGLIB=%PGINSTALL%\lib\ set POSTGISVER=2.0 xcopy bin\*.* "%PGBIN%" xcopy /I /S bin\postgisgui\* "%PGBIN%\postgisgui" xcopy /I plugins.d "%PGADMIN%\plugins.d" xcopy lib\*.* "%PGLIB%" xcopy share\extension\*.* "%PGINSTALL%\share\extension" "%PGBIN%\psql" -c "CREATE DATABASE %THEDB%" "%PGBIN%\psql" -d "%THEDB%" -c "CREATE EXTENSION postgis;" "%PGBIN%\psql" -d "%THEDB%" -c "CREATE EXTENSION postgis_topology;" REM Uncomment the below line if this is a template database "%PGBIN%\psql" -d "%THEDB%" -c "UPDATE pg_database SET datistemplate = true WHERE datname = '%THEDB%';GRANT ALL ON geometry_columns TO PUBLIC; GRANT ALL ON spatial_ref_sys TO PUBLIC" pause

Tipps und Tricks

Selbststudium

  • tbd.

Quellen

  • tbd.