2

I have successfully loaded a large number of .asc images (>2800 200x200 tiles) into a Postgres table with PostGIS 2.1 support. The new table appears in QGIS's DB Manager and I can add the whole image as a single layer.

Is there a way, for example, to create an SQL script on raster tables and display the result in QGIS as a raster layer as you might with a vector layer? Or simply to filter the table to specific tiles.

Within QGIS, the DB Manager allows me to load the whole table but doesn't seem to support filtering of the table, and neither does right clicking on the layer once its loaded.

This is my first foray into PostGIS and rasters so the answer may be obvious so please have patience with me.

4

You can't quite do an SQL script, however you can create a database view via DbMAnager or pgAdmin or psql, and then from DbManager drag that raster view unto QGIS Map.

Also as I recall, I don't think the newer versions of QGIS try to load the whole table, so if you have your map set already, it should load just enough to fit in that area. It will also take advantage of overview tables for performance speedup.

So when you load raster data, make sure to do it with the -l option to build overview tables.

http://postgis.net/docs/manual-2.1/using_raster_dataman.html#RT_Raster_Loader

In 2.2 we should have some functions that also allow you to do that for data already in the db.

  • I just wanted to add that this works extraordinarily quickly, even when creating sizeable views of raster layers clipped in postgis. My workflow is being instantly changed! – Adrian Apr 30 '15 at 15:33

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.