[postgis-devel] What to return when refering to an invalid band number

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Thu Mar 24 15:37:16 PDT 2011


Right now if I do this query on a raster having only one band:

  SELECT ST_Value(rast, 0, 1, 1) FROM myraster

I get "ERROR:  RASTER_getPixelValue: Invalid band index (must use 1-based)"

If I do:

  SELECT ST_Value(rast, 2, 1, 1) FROM myraster

I get "NOTICE:  Could not find raster band of index 2 when getting pixel value. Returning NULL"

and a NULL value.

The answer should be the same if I ask for band 0 or band 2 but which one? An error or a warning with a NULL (or a set of NULL for a tiled coverage)?

This symptom is generalised to every other function getting band properties (st_bandnodatavalue, st_bandpixeltype, etc...).

Pierre




More information about the postgis-devel mailing list