2

When I link my postgres/gis table to QGIS I expect to be able to add the table into QGIS. But for some reason QGIS does not recognize my tables as geometry tables. The datasets were originally shapefiles. After uploading them with the shapefile uploader of postgis they do have a geom column.

When I uploaded them I did have to change UTF 8 to LATIN1. Postgis is enabled in my database.

I would like to know why it is not working, I don't know where to start. Can anybody help me out here?

On advise of a comment I have added the result of the geom column when doing \d tablename in the psql shell.

 geom       | brondata.geometry(MultiPolygon,28992) |
Indexes:
    "wijk_2014_pkey" PRIMARY KEY, btree (gid)
    "wijk_2014_geom_idx" gist (geom)
  • Do the tables not appear in the dialog at all? Maybe edit your question with the output of \d for that table. – Rob Skelly Sep 26 '15 at 21:58
  • They do not appear at all. I am connected to the schema, but it appears empty. I dont understand the last part of your comment 'the output of \d for that table' – Zuenie Sep 26 '15 at 22:46
  • Oh, sorry. If you log into PostgreSQL from the command line and type \d tablename (where tablename is the name of your table) it'll print out a description of the columns, including some information about the geometry column. – Rob Skelly Sep 26 '15 at 22:52
1

The schema where you installed postgis looks non-standard. Looks like you have it installed in brondata schema and that might not be in your database search_path. That would be the easiest issue to fix.

It's also possible you managed to install two versions of postgis (an old 1.5 and a newer). Do the following:

SELECT * FROM geometry_columns;

That should return a listing of columns in your database with geometry. I'm suspecting you might have two versions of PostGIS installed, and QGIS is reading the version not tied to your data or the above query fails, which means you just don't have postgis functions, tables in your search_path.

What does:

SELECT postgis_full_version();

Note that for PostGIS to work, you need to have it in your search path. So if the above queries fail, it means you don't have the schema where postgis is installed in search path. Do an:

ALTER DATABASE your_data_base SET search_path=public,brondata;

Or alternatively if you installed PostGIS by accident in brondata, using extensions, you can move it with say:

ALTER EXTENSION postgis SET SCHEMA public;
|improve this answer|||||
  • I did have two versions of postgres installed. I guess that was the problem. I fixed it by recreating everything I had. A new database and a new schema with postgis, uploaded the same data. And now it works. – Zuenie Sep 27 '15 at 18:30

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.