Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PostgreSQL(v.9.2)/Postgis(v.2.0.3) database which includes raster layers (added through raster2pgsql).

To open them in QGIS (v.1.8.0-Lisboa), the "Add Postgis layer" menu will not work; apparently it does not recognize the "raster" type as a geometry.
But I was able (following this little gem of advice) to add the raster layers to the canvas by opening the QGIS DB Manager, right-clicking the layer, and selecting "Add to Canvas". Yesterday, all this worked fine.

Today, when I try this same procedure for the same layers in the same DB, nothing happens, they are not added to the canvas.
If I try to drag them onto the canvas, I get an error message "The layer is not a vaild layer and can not be added to the map".

The layers in the DB have not been changed in any way since yesterday (except perhaps by occasional Vacuuming of the whole DB).
They do have a "rid" and a "rast" attribute, and the latter is filled with long strings (looking similar to geometry values), thus probably still correct, at least not empty.

Dropping (deleting) one of the layers and recreating it from scratch (using exactly the same batch files as before) did not help; they were again flagged as "invalid layers".

I then created raster layers from the same data (and still using the same batch files) in a freshly created new DB, and here it all works again: both right-click > "Add to canvas", or dragging from the DB Manager will add the layer to the QGIS canvas just fine. Let's see for how long.

Is there any chance at all to fix the issue in the older DB?
If so: In which direction would I even have to look to find out what the problem is? DB corruption? QGIS settings? GDAL stuff?

Thanks for any pointers.

share|improve this question

closed as off-topic by underdark Nov 3 '13 at 14:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – underdark
If this question can be reworded to fit the rules in the help center, please edit the question.

Pseudo-solution: One day (and, probably more important, one reboot) later, all is back to normal also in the old database; raster can be loaded into QGIS again via DB Manager. I should perhaps straight away have followed the Windows panacea to solve everything: reboot, then re-install Windows, then format C:. Explanations of the temporary failure are still welcome. – clüles May 18 '13 at 6:57
I had this same issue and found a fix for mine. I have QGIS installed via OSGeo4W and when I open QGIS using a map file (mymap.qgs), loading of the raster fails, and I can't even use DB manager to load the layer (invalid layer error). If I open QGIS using the desktop shortcut and open the map file, or create a new one and then add the raster from DB manager, it works with no problems and no reboot needed. I hope this helps – James N Mar 30 '15 at 11:38

Browse other questions tagged or ask your own question.