In today’s QGIS tutorial we will be opening a PostGIS table in QGIS. For a start we can start by knowing what PostGIS is and what it is used for.

PostGIS – this is a PostgreSQL spatial extension that enables the PostgreSQL database to store spatial data and information. It can be also used to centralize the spatial database in the GIS system.

So basically after this tutorial you should be able to do two things, and that is

  • connect to PostGIS through QGIS and
  • Open PostGIS dataset in QGIS

In this tutorial we assume that you already have installed PostGIS on your machine. If you haven’t done that yet, you might have to read this article on Installing PostGIS on Linux. After the installation you can catch up and continue reading this article.

Create a connection

Open your QGIS desktop and navigate to Layer –> Data Source Manager and then click PostgreSQL from the left panel. This is where we will create the connection from.

At the moment the list is empty so click on New to configure a new PostGIS connection.

In order to create a successful connection you will need to input the following details:

  • Host name
  • Port number
  • Database name
  • Username & Password

The Host name can also be the IP Address of the PostgreSQL Server.

When you have entered all the required details click OK. Always make sure to test the connection first to avoid any unexpected outcomes while halfway through your work and to also avoid disappointment.

Opening the PostGIS Tables

Click Connect and your PostGIS tables will be visible. Among the list of tables that appear, click the table that you intend to use and click the Add button and the PostGIS Table will be ready for use.

Hopefully this will help out during the process of using QGIS. If you face any challenges kindly start discussion in the Forum for everyone’s benefit.