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

Mateusz Loskot mateusz at loskot.net
Thu Mar 24 16:31:17 PDT 2011


IMHO, index out of range is an error condition, an exception, and as such it should result with error.

-- 
Mateusz Łoskot, http::/mateusz.loskot.net
(Sent from my mobile)

----- Reply message -----
From: "Pierre Racine" <Pierre.Racine at sbf.ulaval.ca>
Date: Thu, Mar 24, 2011 23:13
Subject: [postgis-devel] What to return when refering to an invalid band	number
To: "Mateusz Loskot" <mateusz at loskot.net>, "PostGIS Development Discussion" <postgis-devel at postgis.refractions.net>

The question is more “returning an error or a warning (with null values)…” I will deal with the message text…

From: Mateusz Loskot [mailto:mateusz at loskot.net]
Sent: 24 mars 2011 19:11
To: Pierre Racine; PostGIS Development Discussion
Subject: Re: [postgis-devel] What to return when refering to an invalid band number

Pierre,
What about returning "band index is out of range" for any
invalid band index?

Regards,
--
Mateusz Łoskot, http::/mateusz.loskot.net
(Sent from my mobile)

----- Reply message -----
From: "Pierre Racine" <Pierre.Racine at sbf.ulaval.ca>
Date: Thu, Mar 24, 2011 22:37
Subject: [postgis-devel] What to return when refering to an invalid band number
To: "PostGIS Development Discussion" <postgis-devel at postgis.refractions.net>

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

_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20110324/df3e1198/attachment.html>


More information about the postgis-devel mailing list