Wednesday, 16 November 2016

Why can't I open postgis layers in QGIS?


I've set up a table in PostGIS using OSM data (converted using osm2pgsql). I know this database is good, because I'm able to import it and work with it in TileMill, but whenever I try to interact with any of the layers in QGIS (1.8.0, OSX), the Add button is greyed out (even if I put in a query).


I've tested the connection and when I test my queries it shows that lots of rows were returned, so (again), the data's clearly there—I just can't open it up.


CLARIFICATION: It's also worth noting that QGIS is able to see the database just fine. I can build queries and read out data in the Add PostGIS layer interface and everything comes back correctly. The only thing I can't do in the Add PostGIS Layer interface is add the layer.


CLARIFICATION 2 (from the comments): postgis_version returns 2.0 USE_GEOS=1 USE_PROJ=1 USE_STATS=1. The extensions active on the database are plpgsql (1.0), postgis (2.0.3), and postgis_topology (2.0.3). Postgres and postgis were installed using Homebrew.


The table does (now) have a primary key, but QGIS doesn't appear to find it.


Screenshots: http://ge.tt/api/1/files/4chLoGn/0/blob/x675?noinc=1 http://ge.tt/api/1/files/4chLoGn/1/blob/x675?noinc=1



Answer




The problem, as it turns out, was that I had not named the connection.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...