How To Install and Use PostGIS

What is PostGIS?

PostGIS is software that stores additional spatial data to geographic objects through the PostgreSQL database. It operates as a “light-weight” software with geometries and indexes that use less memory. It also includes additional features such as Oracle Locator/Spatial and SQL Serve. To see more features included click here.

PostgreSQL draws its origins from Ingres Database (INteractive GRaphics REtrieval System) which was developed to support commercial and government applications. The name refers to it being "post-ingres." (See Ingres (database) for more information).

A PostGIS layer is stored in a PostgreSQL database and helps you to include more information to support GIS objects. This system allows you to identify work more accurately than with adding vector layer in QGIS.

This tutorial is for QGIS version 2.0.1 Dufor on a Mac


To use a PostGIS layer, you must have PostGIS installed and connected to a PostgreSQL database.

To install PostgreSQL and PostGIS:

  1. Go to the PostgreSQL website and click “Download” then select your operating system version (Mac OS). Or click here
  2. Click the “Download” link for the “Graphical installer”
    Screen%20Shot%202013-12-07%20at%201.13.07%20PM.png
  3. On the latest download version (at the top of the screen), select your operating system version (Mac OS) and save the file.
  4. PostgreSQL will download as a .zip file. To unzip and use it, double click on the .zip file, and then double click the “postgresql…” to open the program.
    Screen%20Shot%202013-12-07%20at%201.23.17%20PM.png
  5. Follow the Setup Wizard, providing when prompted a password of your choice (you will use this password in the future, so write it down), the provided Port number (5432), and the Default Locale.
  6. When it has finished downloading, click “Okay” with the Stack Builder box checked. In the dropdown box, select the “PostgreSQL” option.
    Screen%20Shot%202013-12-07%20at%201.34.40%20PM.png
  7. Under the categories list, select arrow to view the “Spatial Extension” category, and check the box for “PostGIS” and click “Next”
    Screen%20Shot%202013-12-07%20at%201.39.00%20PM.png
  8. It will now direct you to install “PostGIS.” When promted for a password, use the password you created before on the PostgreSQL Setup Wizard. Continue as directed, and click “Finish” when completed.
    Screen%20Shot%202013-12-07%20at%201.44.54%20PM.png
  9. To check that you installed it correctly, go to your Applications menu and select the “PostgreSQL” folder, then click “pgAdmin III” (with the poorly drawn elephant image.)
    Screen%20Shot%202013-12-07%20at%201.52.15%20PM.png
  10. On the “pgAdmin” window that appears, double click the “PostgreSQL” option on the Object browser menu (under Server Groups > Servers > PostgreSQL), and a dialog box prompting you to enter your password will appear.
    Screen%20Shot%202013-12-07%20at%201.51.01%20PM.png
  11. Enter your password. Use the dropdown menu under “PostgreSQL” to access PostGIS by selecting the arrows next to Databases > template_postgis > Schemas > public > Functions. This will give you access to all of the PostGIS spatial functions.
Screen%20Shot%202013-12-07%20at%202.07.42%20PM.png

For more tips and help see:

Video tutorial for installing PostGIS

QGIS User Manual

Wikipedia: PostgreSQL

Wikipedia: Ingres (database)