31
Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows environment Marco Negretti – [email protected] 23/12/2011

Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

Embed Size (px)

Citation preview

Page 1: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

Laboratorio di Geomatica

Installing PostgreSQL/PostGIS and QGIS in Windows environment

Marco Negretti – [email protected]

23/12/2011

Page 2: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

2Index

✔ Installing QGIS✔ Installing PostgreSQL/PostGIS✔ Upload a shapefile in the DB✔ Add a vector DB layer in QGIS

Page 3: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

3Installing QGIS

✔ Home page➢ http://www.qgis.org/

✔ Download➢ http://hub.qgis.org/projects/quantum-gis/wiki/Download

✔ Standalone Installer➢ QGIS-OSGeo4W-1.7.3-00624b3-Setup.exe➢ double click to start the installation

Page 4: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

4Installing QGIS

✔ Start installation:

✔ Accept the term of licence agreement✔ Install QGIS➢ if you desire install also the demo data packages

Page 5: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

5Installing QGIS

✔ Now QGIS is installed

Page 6: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

6Installing QGIS

✔ Double click on desktop icon to start QGIS

Page 7: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

7Installing PostgreSQL/PostGIS

✔ Home page➢ http://www.postgresql.org/

✔ Download➢ http://www.postgresql.org/download/windows/

✔ One click installer (Win32bit)➢ postgresql-9.1.2-1-windows.exe➢ double click to start the installation

Page 8: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

8Installing PostgreSQL/PostGIS

✔ Start installation:

✔ Accept the default installation option (directory, port,...)

✔ Set a password for the postgres user (and remember it!)

Page 9: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

9Installing PostgreSQL/PostGIS

✔ At the end of installation launch the stack builder to install the PostGIS template

Page 10: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

10Installing PostgreSQL/PostGIS

✔ Select your version of Postgres and eventually set the proxy parameters connection

Page 11: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

11Installing PostgreSQL/PostGIS

✔ Select PostGIS... in Spatial Extension menu

…begins the download procedure...

Page 12: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

12Installing PostgreSQL/PostGIS

...and then you can start the installation

Page 13: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

13Installing PostgreSQL/PostGIS

✔ Select PostGIS and Create spatial database

Page 14: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

14Installing PostgreSQL/PostGIS

✔ Insert the connection information: user, password and port(set during PostgreSQL installation)

Page 15: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

15Installing PostgreSQL/PostGIS

✔ When request, enable shp2pgsql plugin:

Page 16: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

16Installing PostgreSQL/PostGIS

✔ Installation completed

Page 17: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

17Installing PostgreSQL/PostGIS

✔ Start pgAdmin III

Page 18: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

18Installing PostgreSQL/PostGIS

✔ Right click to connect to the database

Page 19: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

19Upload a shapefile in the DB

✔ Create your spatial database➢ right click to view the menu➢ set the database name and the owner

Page 20: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

20Upload a shapefile in the DB

✔ Select as template template_postgis

Page 21: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

21Upload a shapefile in the DB

✔ Connect to your new DB➢ there are tables and functions for spatial data

Page 22: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

22Upload a shapefile in the DB

✔ Use the plugin to upload data

Select the shapefile

Page 23: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

23Upload a shapefile in the DB

✔ If the data are correctly uploaded (press F5 key to refresh), there is a new table:

Page 24: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

24Add a vector DB layer in QGIS

✔ Select Add Vector layer

Page 25: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

25Add a vector DB layer in QGIS

✔ Select Database as source and PostgreSQL as type

✔ Then click on new to create a new connection

Page 26: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

26Add a vector DB layer in QGIS

✔ Insert the connection information

test the connection

Page 27: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

27Add a vector DB layer in QGIS

✔ Now, you can open the connection

Page 28: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

28Add a vector DB layer in QGIS

✔ Select the coordinate reference system

Page 29: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

29Add a vector DB layer in QGIS

✔ If you have more than one map, choose the one to add

Page 30: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

30Add a vector DB layer in QGIS

...and finally you can view the map in QGIS

Page 31: Installing PostgreSQL/PostGIS and QGIS in …geomatica.como.polimi.it/corsi/sw_gis/postgis_qgis_inst.pdf · Laboratorio di Geomatica Installing PostgreSQL/PostGIS and QGIS in Windows

31

QGIS: 1.7.3

PostgreSQL: 9.1.2 (32bit)

PostGIS: 1.5.3

http://creativecommons.org/licenses/by-nc-nd/3.0/

http://www.libreoffice.org/