In the previous tutorial we learn how to install PostGIS on Ubuntu 22.04. Now we are going to show you how to export layer from QGIS to PostGIS database. In this example, I run the PostGIS on a remote computer in my local network. If you have the similar setup, you need to make sure that your PostgreSQL is accepting the remote connection.
PostGIS is a PostgreSQL database extension. With this extension we can store the spatial data directly into the database. For example, we can store the points, polyline, and polygon in the database. Then, we can use these features in various GIS software especially QGIS. QGIS is a free and open source GIS software that supports many types of spatial data, including PostGIS.
Steps to Export Layer to PostGIS in QGIS
In this tutorial, we have a contour layer (polyline). We are going to export this layer to our PostGIS database. Please follow these steps below
Step 1. Create PostgreSQL Connection in QGIS
In order to create a new PostgreSQL connection in QGIS, open QGIS and then right-click the PostgreSQL from the QGIS browser panel. Choose New Connection. We have created a short video showing how to create a new PostgreSQL connection below.
Step 2. Export to PostGIS
Now open the layer or spatial data that we are going to export. In this example, we have a contour layer from shapefile. Once the shapefile or the layer is opened, search for the tool called Export to PostgreSQL. Double-click the tool and enter the PostgreSQL server and database details.
I hope the video explains better than my writing. Thanks for reading, and until next time.