Im using shell-script, postgis2.0 and gdal for trying to clip raster apart, using an overlapping raster and a the_geom-object. At first I create a view to clip the overlapping part of the raster. It gives me several raster-tiles as results, which I bundle with st_union as one raster. It works all fine and i can see results in the tables.
psql -h localhost -p 5432 -d testlauf -U postgres <<EOF
CREATE OR REPLACE VIEW profilschnitt.cliptest AS
SELECT st_union(st_clip(a.rast, b.the_geom))
FROM rastertable a
JOIN tiletable b
ON (st_envelope(a.rast) && b.the_geom);
EOF
Now i want to see how the unified raster looks in GIS and try to export the raster via gdal_translate into SAGA-rasterformat:
gdal_translate -ot Float32 -of SAGA PG:"host=localhost port=5432 dbname=testlauf user=postgres password=postgresdb schema=profilschnitt table=cliptest mode=2" ~/Desktop/cliptest.sdat
Problem is, that gdal tells me the following:
ERROR 1: Error browsing database for PostGIS Raster properties
GDALOpen failed - 1
My db-connection is set up correctly and gdal-translate already worked with other raster-views/-tables too. So I assume that the problem must be somewhere within the query-view... For any ideas i would be grateful :)
