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

Jorge Arévalo jorge.arevalo at deimos-space.com
Fri Mar 25 04:02:57 PDT 2011


On Fri, Mar 25, 2011 at 12:31 AM, Mateusz Loskot <mateusz at loskot.net> wrote:
> 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)
>

+1 for that.


> ----- 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
>
>
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
>



-- 
Jorge Arévalo
Internet & Mobilty 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 postgis-devel mailing list