QGIS – Load data into PostGIS

Marketing
Marketing
  • Updated

By David Crowther

QGIS___Load_data_into_PostGIS_-_1.JPG

Question:

How can I load data into my PostGIS database?

Answer:

Why not use the Export to PostgreSQL tool available in the Processing Toolbox!

From the Processing menu choose > Toolbox > open the Database section and choose the Export to PostgreSQL menu option.

QGIS___Load_data_into_PostGIS_-_2.JPG

The Export to PostgreSQL Tool will open.

QGIS___Load_data_into_PostGIS_-_3.JPG

We will use the following settings:

  • Input Layer - choose the GIS file that you wish to upload – in this example UK Ceremonial Counties
  • Database – choose your PostGIS database Connection – this will need to have been created already
  • Schema – choose the Schema within your PostGIS database that you wish to upload the layer into. Here we will choose Public
  • Table – choose a name for the uploaded layer e.g., uk_counties or leave it blank to use the existing layer name
  • Primary Key Field – choose an existing field in your data to assign as the Primary Key
  • Geometry Column – choose a field name for the geometry column, the default will be geom

QGIS___Load_data_into_PostGIS_-_4.JPG

There are also some additional options that you can choose to tick and apply where needed:

QGIS___Load_data_into_PostGIS_-_5.JPG

If you now Run the Export to PostgreSQL Tool, the chosen GIS layer will then be uploaded and imported into the PostGIS database.

QGIS___Load_data_into_PostGIS_-_6.JPG

Now, within QGIS you can use the Add Layers > PostGIS option to connect to PostGIS and add your new PostGIS table –

QGIS___Load_data_into_PostGIS_-_7.JPG

QGIS___Load_data_into_PostGIS_-_8.JPG

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.