[gdal-dev] reading postgis raster in mode 2 error

Jorge Arévalo jorge.arevalo at deimos-space.com
Fri Aug 26 16:57:22 EDT 2011


---------- Forwarded message ----------
From: Ricardo Filipe Soares Garcia da <ricardo.garcia.silva at gmail.com>
Date: Wed, Aug 24, 2011 at 6:07 PM
Subject: reading postgis raster in mode 2 error
To: gdal-dev at lists.osgeo.org


Hi list

I am trying out the postgis raster driver.

I'm running Ubuntu 11.04 with gdal 1.8 from the ubuntugis repository.
As for postgis I've compiled a snapshot of postgis 2.0 from svn, as
offered on the postgis website.

Following the directions in the driver info page[1], I've been trying
to get a gdalinfo on the katrina.tif file. When I run it using
mode='1' everything goes as expected and I get info on each of the
tiles.

but when using mode='2' I am getting this error:

gdalinfo -mm -stats -checksum "PG:host='localhost' dbname='gis_testes'
user='gisuser' password='resusig' table='katrina' mode='2'"


ERROR 1: Error, the                     ONE_RASTER_PER_TABLE mode
can't be applied if the raster                     rows don't have the
same metadata for band 1
gdalinfo failed - unable to open 'PG:host='localhost'
dbname='gis_testes' user='test_user' password='test_pass'
table='katrina' mode='2''.


When importing the file into postgis I ran the following command:

/usr/lib/postgresql/8.4/bin/raster2pgsql.py -r ~/Downloads/katrina.tif
-t katrina -k 64x64 -o katrina.sql -s 4326 -I


Thanks for your help

[1] - http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html

--
___________________________ ___ __
Ricardo Garcia Silva


Hi Ricardo,

That error is caused because this query

select (foo.md).* from (select distinct st_bandmetadata(rast, n) as md
from katrina) as foo

(being 'n' the band number).

returns more than one result, and it shouldn't. Could you please
execute that query in a client and send me back the results?

Best regards, and sorry for the inconvenience

-- 
Jorge Arévalo
Internet & Mobility Division, DEIMOS
jorge.arevalo at deimos-space.com
http://es.linkedin.com/in/jorgearevalo80
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com
http://geohash.org/ezjqgrgzz0g


More information about the gdal-dev mailing list