PostGIS and QGIS in 4 minutes

QGIS provides an excellent interface to get started with PostGIS, and (if you are a Mac user) you can start with PostGIS using Postgres.app very fast! Check out the video and follow along using this guide.

Download and install Postgres.app

First, head over to this site to download and install Postgres.app. This is a complete PostgreSQL database with PostGIS as well that is ready to use on your Mac.

Create a new database and install PostGIS

Next, you will need to create a new database. You can most likely use the standard settings but you can always customize if you want. Next, double click on the database you plan to use in the Postgres.app interface. This will open a terminal window where you can install PostGIS using this command:

CREATE EXTENSION postgis;

Do not forget the semi-colon! Once you run this, PostGIS will be ready to use.

Connect PostGIS to QGIS

Connecting your new database to QGIS is actually a really easy process! Just open Layer > Add Layer > Add PostGIS Layer. From there you can enter the details about your database and connect it.

Add data to your database

QGIS also provides great tools for you to add data to your database. Navigate to Database > DB Manager and then select your database. From there you can click on Import Layer/File… to add a layer from your QGIS project of a file on your computer.

Query your data!

Finally, you can start to query your data using the same DB Manager, and then adding layers as views or creating new tables!

Check out some other resources

If you are interested in learning more, check out this guide where I have my favorite spatial SQL guides and resources: