Why pair QGIS with PostGIS?
Visualizing spatial data is one of the most practical ways to make sense of it, and QGIS is one of the most accessible tools for the job. It’s free, open source, and designed to work cleanly with spatial data stored in a PostgreSQL database that has the PostGIS extension enabled. The workflow is straightforward: load OpenStreetMap (OSM) data into PostGIS, connect QGIS to that database, and start composing map layers.
Installing QGIS
Start by downloading QGIS from the official site. The installer guides you through the rest; installation is quick and does not require special configuration for this use case.

The steps are standard, as shown in the installation sequence below.




Getting data into PostgreSQL
Before you can visualize OSM data, it has to live in a PostgreSQL database. A common route is osm2pgsql, which has become the de facto loader for OSM data into PostgreSQL. If you prefer a managed approach, Scalefield (a PostgreSQL provisioning tool) can create an instance and populate it with OSM data during setup, which is the path used here.




For this example, Andorra’s OSM data is a sensible test set because it loads quickly and keeps the rest of the exercise simple. Any other regional extract will behave the same way.
Connecting and building map layers
Once your data is in place, the first step in QGIS is to establish a database connection. Use the “Create a New PostGIS connection” option and enter the connection details in the dialog that appears.

QGIS lets you test the connection immediately from that same form, so you can confirm everything is reachable before moving on.
Maps in QGIS are assembled from layers. Instead of a single flat image, you combine multiple types of information — roads, boundaries, points of interest — into one view. Here, the source is the four OSM tables in your PostGIS database. Select the Andorra dataset on the left and mark the columns you want to include; QGIS renders them as layers right away.




Beyond the first map
That’s the core loop: connect to PostGIS, pick your layers, and QGIS draws the map. The whole process takes minutes. From there, QGIS supports more elaborate maps and even spatial editing directly against the database. For a related exercise in spatial analysis, see this walkthrough of the Traveling Salesman Problem with PostGIS and pgRouting, which builds on the same PostgreSQL + PostGIS stack.



