Kurs PostGIS Einführung II: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
K (Programm)
(Abschnitt 'Installation' entfernt, Abschnitt Software: wie bei Kurs I von Benötigte Software für Kurse PostGIS-Einführung I & II transcludiert)
Zeile 85: Zeile 85:
 
* [[PostGIS-Beispiele]]
 
* [[PostGIS-Beispiele]]
  
== Installation ==
+
== Software ==
 
 
Installation of PostgreSQL 9.1 (production, 32bit) with PostGIS 1.5 (production), PostGIS 2.0 Experimental (32bit) and QGIS:
 
* 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 (NOTE: Internet access is needed here)
 
* 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 makepostgisdb.bat (includes raster), and edit POSTGIS_INSTALL_DIR to adapt following variables: PGPASSWORD, THEDB, PGINSTALL (see listing below).
 
*** The only difference in these edits is one environment variable: for makepostgisdb_using_extensions.bat its 'THEDB=postgis20_extension' and for makepostgisdb.bat its 'THEDB=postgis20'.
 
*** Open a CMD-Shell as administrator (NOTE FOR WINDOWS USERS! Choose cmd.exe from Start menu but run cmd.exe with right click on it 'Run as administrator'!)
 
*** In CMD-Shell run makepostgisdb_using_extensions.bat and makepostgisdb.bat
 
* Step 4: ActivePerl (optional for certain courses, pls. ask course leader!)
 
** The database (Uster) needs pl/perl scripts inside PostsgreSQL db. We install ActivePerl ([http://www.activestate.com/activeperl/downloads Windows-Version]).
 
* Step 5: Installation of QGIS (Quantum GIS) Stable Version and Trunk Version
 
** There are two different installers. We use OSGeo4W ([http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe osgeo4w-setup.exe]) (NOTE: Internet access is needed here)
 
*** When asked about the installation/runtime directory path, choose default (e.g. 'C:\OSGeo4W') on Windows. Usually you would install programs under 'C:\Program Files (x86)'. But there is evidence that some tools could be bothered by spaces in paths.
 
*** Choose "Advanced Installation" (use the newest version of each software => mostly the first click in the installation tree)
 
*** Category „Commandline Utilities“: setup: OSGeo4W Installer/Updater
 
*** Category „Desktop“: qgis, qgis-dev (NOTE: 'qgis-dev' means "Trunk"-Version)
 
*** Category „Libs“: psycopg2, pyqwt5-qt4, qt4-devel
 
** NOTE: This installation includes by default Python (2.5.2)
 
* Finish: Restart system (in order to restore environment like paths to libraries).
 
 
 
File 'makepostgisdb_using_extensions.bat':
 
  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
 
 
 
 
 
 
 
Creating new database 'Uster':
 
* Preparation steps:
 
** Close all postgres clients, if there are any open (like pgAdmin3, plsql, QGIS).
 
** Cleanup database (if needed): If there is already a database 'uster' drop it!
 
* Start pgAdmin3 as dbadmin
 
* Create new database:
 
** Name 'uster15', encoding: UTF-8, template: postgis15 (or postgis)
 
* Select database 'uster15'
 
** Activate extensions (right click) "New Object..." > "New Extension...":
 
** Choose extensions: adminpack, ltree and plperl.
 
 
 
 
 
Importing data into database 'uster':
 
* Start pgAdmin3 (as dbadmin)
 
* Choose (right click) "Restore..."
 
** Choose „uster.dump“ (All filese *.*)
 
** Change „Restore Options #1“ with following 3 options in order to ignore Owner/Privileges: "Don't save: Owner, Privilege, Tablespace".
 
* Import runs some minutes.
 
 
 
Importing another demo database:
 
* See British Columbia Data 'bc_data' at [[PostGIS-Beispiele]].
 
  
 +
{{:Benötigte Software für Kurse PostGIS-Einführung I & II}}
  
 
[[Kategorie:Weiterbildung]] [[Kategorie:PostGIS]] [[Kategorie:PostgreSQL]]
 
[[Kategorie:Weiterbildung]] [[Kategorie:PostGIS]] [[Kategorie:PostgreSQL]]

Version vom 11. September 2014, 11:36 Uhr

GISpunkt-Seminar "PostGIS Einführung II (inkl. PostgreSQL)" (Kürzel Sem_PostGIS_FF).

 Nächste Durchführung: Fr. 12. September 2014 >> Zur Anmeldung (.PDF)
 Übernächste Durchführung: Fr. 23. Januar 2015

Siehe auch:

Organisation

  • Dauer: 1 Tag, 9:00 bis ca. 16:30 Uhr plus Selbststudium.
  • Kosten (inkl. Unterlagen, 1 Kaffee und 1 Mittagessen):
    • Kategorie 1. Regulärer Teilnehmender CHF 700.--
    • Kategorie 2. UNIGIS-Studierende, BIZ-GEO-Lernende, Hochschul-Mitarbeitende CHF 550.--
    • Kategorie 3. Studierende an einer Hochschule bis 25 J., HSR-Mitarbeitende CHF 350.--.
  • Dieser überarbeitete Kurs ist besonders geeignet für Techniker und Entscheider, die mit GIS zu tun haben. UNIGIS-Studierende erhalten (bei Erfolg) einen ECTS-Punkt angerechnet.
  • Vorkenntnisse: Grundkenntnisse in Datenbanken (SQL).
  • Referenten: Prof. Stefan Keller (HSR) und Andreas Neumann (GIS Stadt Uster).
  • Schulungsart: Der Anteil Uebungen und Theorie ist in etwa ausgeglichen. Die Teilnehmenden nehmen einen eigenen Laptop/Notebook mit (wir haben Laptops mit vorinstallierter Software). Es ist Sache der Teilnehmenden, ihr Laptop/Notebook gegen Beschädigung und Diebstahl zu (ver)sichern.
  • Durchführung: Die Teilnehmerzahl ist beschränkt auf 12 (max. 15) Plätze. Der Kurs findet ab fünf zahlenden Teilnehmern statt.
  • Abmeldungen: Angemeldete Teilnehmende können sich bis eine Woche vor Beginn ohne Kostenfolge schriftlich abmelden. Bis drei Tage vorher muss pauschal 200.- in Rechnung gestellt werden. Bei noch späteren Abmeldungen muss der volle Schulungsbetrag verrechnet werden.
  • Selbststudium: Auf Anfrage und nach Absprache (dieses steht im Zusammenhang mit der Anrechnung eines ECTS)

Programm

  • 09:00-09:15 Einführung, Vorstellung. (sep. Gruppe (A) diejenigen, die installieren, (B) die schon installiert haben) (SK)
  • 09:15-10:00 Gruppe A: Installation und Daten einlesen. (AN mit Helfer)
  • 09:15-10:00 Gruppe B/Fortgeschrittene: Daten einlesen,dann Fragen (SK)
  • 10:00-10:15 Überblick PostGIS 2.0, inkl. Extensions, Datentyp Geography. (AN)
  • 10:15-10:30 Überblick PostGIS-Tools (SQL-Shell in QGIS, weitere Tools) (AN + SK)
  • 10:30-11:00 PAUSE
  • 11:00-11:45 "Spatial SQL Advanced" mit PostgreSQL: Views (mit IDs), Trigger (Nachführung Fläche, Constraints im Leitungskataster), Rules (Updatable Views), Konsistenz-Checks. (AN)
  • 11:45-12:30 Neue Vektorgeometrie-Funktionen in PostGIS 2.0 mit Übung. (SK)
  • 12:30-13:30 MITTAGESSEN
  • 13:30-14:00 Übung komplexe räumliche SQL-Abfragen. (AN)
  • 14:00-15:00 PostGIS Raster mit Übung (mit QGIS). (AN)
  • 15:00-16:15 Div. Themen nach Rücksprache (z.B. EXPLAIN, PostGIS Routing). (SK)
  • 16:15-16:30 Ausblick (u.a. Pointcloud, 3D, Topologie ). (SK)

Vorkenntisse:

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

Nicht behandelt:

  • PostGIS 3D, Topologie Performance-Optimierung, PostGIS-spezifischer Server-Setup (Konfiguration, Tablespaces, Clustering, Read-only-Optimierung)
  • PostgreSQL Optimierung
  • Lineare Referenzierung
  • Replikation
  • DE-9IM
  • Integration mit ArcGIS SDE
  • etc.

Unterlagen/Übungen

Siehe auch Materialien im Kursordner.

Online-Doku.:

Literatur:

Support/Firmen:

Software:

Daten:

Tipps und Tricks

Siehe Diskussion:Kurs PostGIS Einführung II

Weitere:

Software

Voraussetzungen: Gängiger Laptop mit gängigem Betriebssystemen (Windows, Linux, Mac), funktionierendem WLAN-Anschluss und Administrations-Rechten (zur Installation von Software).

PostgreSQL Release 14 (Release >= 12 aber mindestens 9.4.7 oder neuer ist auch OK, wenn's nicht anders geht) zusammen mit PostGIS 3.

Der Ablauf ist immer so, dass zuerst PostgreSQL installiert wird, dann PostGIS (siehe PostGIS Binary Installer).

Weitere Software-Tools:

  • pgAdmin4: Ist in der PostgreSQL-Installation dabei (mind. bei Windows); pgAdminIII geht auch, muss aber immer separat installiert werden.
  • QGIS: Installation siehe hier
  • ein Web Browser, ein Texteditor

Falls die Installation nicht klappt, helfen wir gerne bei Kursbeginn – oder aber Sie versuchen es selber auf einem der Support-Kanäle auf PostgreSQL#Support.