1

I have been trying to export my polygon shapefile from Qgis to postgis but have not succeeded.

I have tried such through the 'database' plugin of qgis but still have not got it.

I wish to know how I can do this, whether there is anything I need to do first in either postgis or Qgis before carrying out the process.

11
  • 1
    what exactly did you try? what went wrong? please be more precise in your question. in general, you need to create a DB connection and then e.g. use the import function in the DB manager
    – geozelot
    Apr 19 '18 at 20:36
  • ok. thanks for your concern. To be precise, I have polygon shapefile layer of buildings which I created in Qgis and wish to save it in postgis. To do so, I was instructed by a friend to create in postgis a similar attribute table of the shapefile I wish to export before going to Qgis to make a connection, which I did. Going to Qgis, I deed the normal connection through the Postgis icon and then went to DB icon to do the export, but each time I try an error message appears. The error message is either that my table has no geometry or a similar table which am trying to export already exist.
    – IYKE
    Apr 20 '18 at 7:45
  • the table will be created on import; choose the layer, mark the options for primary key, geom column (no need to change the values), overwrite existing tables (only the first time!) and create spatial index
    – geozelot
    Apr 20 '18 at 8:05
  • I just deed so now, but still receives error message. How I wish I can be able to send u the interface of the error message which I snipped, I believe it will help more.
    – IYKE
    Apr 20 '18 at 8:34
  • Below is exactly what the error message says:
    – IYKE
    Apr 20 '18 at 8:47
2

To be able to use PostGIS functions in QGIS (or anywhere), you must first enable PostGIS in your database.

After having installed the binaries, you must log-in the DB (via psql command prompt, PGAdmin or else) and enable it:

CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;

You can read more on other extensions you may need

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.