I'm trying to load raster from a postGIS connection into QGIS, but I'm getting the following error:

PG: dbname=EnvModel host= user=postgres port=5432 mode=2 schema=public column=rast table=dem10m is an invalid layer - not loaded

I saw this question, but on my case the error is different as you can see. I can add vector layer without any trouble. I thought that it could be a GDAL related issue, but I can access all GDAL functions through the Geoprocessing panel.

I'm using Ubuntu 14.04 LTR, I first faced this problem on QGIS 2.8, which lead me to try QGIS 2.10. Same problem on both versions. I do not have this problem on QGIS 2.8 for OSX and neither at QGIS 2.10 for Windows. I am literally lost at this, the QGIS log is not very helpful as you can see, is it possible to get a more complete log?

  • did you try my suggestion in the other answer, it looks like the same problem? I checked in 2.12 (Ubuntu), it looks as if you can now add rasters to canvas from the DB Manager, as it now prompts for a username and password (although it still gives an error, which is a bit odd) – Steven Kay Nov 1 '15 at 15:29
  • I did try your suggestion and yet nothing worked. I did rl = QgsRasterLayer("PG: PG: dbname=EnvModel host= user=postgres port=5432 mode=2 schema=public column=rast table=add_habitat", "add_habitat") QgsMapLayerRegistry.instance().addMapLayer(rl) I will try 2.12 and see what happens. However, is it odd that DB Manager has a bug on at least 3 distributions? How can I check if my settings are correct on my machine? – Ricardo Oliveira Nov 1 '15 at 17:02
  • 1
    Just like you said, it asks for credentials but gives the same error. But now I see this on the dialog that asks for info. "Cannot open GDAL dataset: (connection into) does not exist in the file system and is not recognized as a supported dataset name" Maybe Iḿ having trouble with my GDAL settings? – Ricardo Oliveira Nov 1 '15 at 17:09
  • I got this error when the password for my user was blank – chrismarx Aug 19 '17 at 17:53

Your Answer

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

Browse other questions tagged or ask your own question.