18

Is it possible to create PostgreSQL views over a table that contains raster data?

I have succeeded in creating the view but the entry in raster_columns is not correct (all the raster info is missing). Also, I couldn't open the SQL view using QGIS (most probably because of the raster_columns not being correct).

It's the same situation as this question on gemetry_columns & views but for the raster column I couldn't find the correct syntax to force the typemod during creation of the view.

All that I could find is this:

raster(ARRAY['8BUI','8BUI','8BUI'], 4326,0.5,-0.5, ...);

but what follows after "..." is a mystery.

Has anybody managed to create a view with correct entries in raster_columns?

A short example will be highly appreciated.

2
  • RT_Raster_Overview? postgis.refractions.net/docs/…
    – Mapperz
    Commented Oct 24, 2012 at 13:45
  • Raster Overview = a lower resolution caricature of a higher resolution table. I don't need a lower resolution, I need a portion of the big raster at the original quality available as a SQL view.
    – asp
    Commented Oct 24, 2012 at 14:32

1 Answer 1

2

Did you create your raster table using raster2pgsql, or specify the -C flag (apply raster constraints) during the load operation? If not, you'll need to apply those constraints with AddRasterConstraints() to ensure that the relevant information about your raster data are registered correctly.

1
  • 1
    The tables were created with raster2pgsql having the -C attribute set: raster2pgsql -I -C -e -Y -F -s 4326 -t 10x10 d:\temp\RasterData\US.tif public.us | %POSTGRESQL_FOLDER%\psql -h localhost -p 5432 -U postgres -d DBTest
    – asp
    Commented Oct 29, 2012 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.