-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 D'oh, I hate it when that happens. I didn't see the PostGIS error tab in the message log. And there QGIS complains about osm_id being not unique. I altered my view like seen below to create a unique ID:
CREATE OR REPLACE VIEW buildings AS SELECT row_number() OVER () AS id, planet_osm_polygon.name, planet_osm_polygon.way FROM planet_osm_polygon WHERE planet_osm_polygon.tags ? 'building'::text; Frank Am 2014-03-06 13:59, schrieb Frank Broniewski: > Hi all, > > I've a problem adding a PostGIS view to my QGIS project. I have a > osm2pgsql database and a view which selects all the buildings from > the planet_osm_polygon table. > > The first thing I notice is that there are two entries for the > buildings view, one with a Polygon spatial type, and one where I > have to select the spatial type. OK, the same is true for the > planet_osm_polygon table, so I think this is OK. > > Now I mark the Polygon-building view and click on the Add button > and I get an error with the db credentials and the below message: > ... is an invalid layer and cannot be loaded. Please check the > message log for details. So here's the output from that - not that > there is more insight to be gained ;-) : dbname='lux' host=XYZ > port=5432 user='XYZ' password='YZX' key='osm_id' srid=3857 > type=POLYGON table="public"."buildings" (way) sql= is an invalid > layer - not loaded > > Adding a view from the planet_osm_point works though. And also if > I add the planet_osm_polygon table with a corresponding filter set. > Any ideas what could be wrong with the view? > > Software versions are: QGIS 2.2 PostGIS 2.1 PostgreSQL 9.3 Ubuntu > 12.04 (Ubuntugis-unstable PPA) > > View def: CREATE OR REPLACE VIEW buildings AS SELECT > planet_osm_polygon.osm_id, planet_osm_polygon.name, > planet_osm_polygon.way FROM planet_osm_polygon WHERE > planet_osm_polygon.tags ? 'building'::text; > _______________________________________________ Qgis-user mailing > list Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user > - -- Frank BRONIEWSKI METRICO s.à r.l. géomètres technologies d'information géographique rue des Romains 36 L-5433 NIEDERDONVEN tél.: +352 26 74 94 - 28 fax.: +352 26 74 94 99 http://www.metrico.lu -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJTGHXzAAoJEHopqW0d1cQVzHMH/3rQbSUhdUkduVqr8Ku3b9pu 4CwCpdl7k3lBPB9g5DpP9/RbfMnx+VaJ8AoI3Pww4l0qPgmSqYWG/gWMAlzR/zze JcirSvkJzc48Cipjqb2D4VqYb0WaHEEFZZrDy4ZHbrHdnTx/wdptViqrYsYF/FnN Er/dkY5LvKVim8hOaXxeEVzhJBwWO4KGmyKwYDisomzEr2jXv+LV0dMAPBfE/QR6 FjwcunPJKN8GJ5U2NSwn09+lZSU8ngmqM4Gv0DrHOc0rMRQ0yw1KtsLTMqkiPioa rjeOzXwm5M6ScDPIarUH6DW3h7ALrTT1e7aw5f2TRc2RtembwUzs2puMqTyMZYc= =pXSf -----END PGP SIGNATURE----- _______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user