Prerequisite: You need to have beginner level knowledge of QGIS and PostGIS to understand this post.
QGIS and PostGIS are one of the most famous open source GIS tools in GIS community. QGIS is used for the visualisation and processing of GIS data where as PostGIS is an extension to PostgreSQL database to store GIS data such as vector and raster data. Combining these tools with each other can greatly improve the productivity of GIS Analysts/Developers.
Using PostGIS on top of QGIS gives us ability to analyse the GIS data using SQL statements and can directly visualise the sql result on QGIS. You can apply all level of SQL operations to your GIS data because your data is stored in PostgreSQL.
QGIS provides Database Manager to work with SQL data. Here, you can connect to PostGIS(Postgresql) database, write SQL queries and directly execute and visualise them on QGIS. To open Database manager in QGS, follows below steps
- First add a PostGIS DB connection to QGIS. Select PostGIS from the options listed on left side of QGIS. Fill the connection details, click OK. You will see database listed over there.
2. Select the DB Manager from Database from the QGIS menu. A DB Manager window will be opened.
3. Select PostGIS from the options listed on left side of DB Manager. Then select the Database you added in first step.
4. Now click on SQL Window icon. It will open a SQL Query editor where we will write SQL queries to analyse GIS data stored in PostGIS.
With the help of PostGIS, we can write powerful SQL queries to analyse the GIS data and with QGIS we can visualise it in real time. In Part-2 of this post, we will take actual GIS data and will analyse them with QGIS and PostGIS to drive some results.