Add PostGIS Layers to QGIS
To add layers from your PostGIS database(s) to your QGIS Desktop, follow below.
1. Create a pg_service.conf entry for your database connection.
For example:
[demodb]
host=mydomain.com
port=5432
dbname=mydb
user=myuser
password=MyPassword
2. On the PostgreSQL icon in the left menu, right-click and select “New Connection”
3. Give your connection a name and enter the Service name from your pg_service.conf entry (“demodb” in our example). Click Test Connection to test and then click OK.
3. Â Expand the node for the new connection you just created as shown below.
4. Right click on the table(s) you wish to add and select “Add Layer to Project”
5. Your PostGIS layer has now been added!
Before publishing your layer to Lizmap, G3W-Suite, or QGIS Server, be sure there is a pg_service.conf entry corresponding to the one you created on the server.
For example:
[demodb]
host=localhost
port=5432
dbname=mydb
user=myuser
password=MyPassword
The file on the server is located at
/etc/postgresql-common/pg_service.conf
If you have any questions or require assistance, simply raise a support ticket and we are here to assist.