[postgis-devel] Expected behavior of rt_raster_has_no_band function

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Oct 21 07:55:59 PDT 2011


Good question...

I think values less than 1 should return an error as they really make no sense... "Does this raster has -1 band?" Did I understood well? "Does this raster has 0 band?" seems to make more sense but actually the true question is "Does this raster has band number 0?" The answer is "never"...

Pierre

> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net [mailto:postgis-devel-
> bounces at postgis.refractions.net] On Behalf Of Bborie Park
> Sent: Thursday, October 20, 2011 11:32 PM
> To: PostGIS Development Discussion
> Subject: [postgis-devel] Expected behavior of rt_raster_has_no_band function
> 
> Hey all,
> 
> I'm wondering as to the proper behavior of the rt_raster_has_no_band function
> (and ST_).  I'm getting the following from calls to ST_HasNoBand...
> 
> 1. SELECT ST_HasNoBand(
> 	ST_AddBand(
> 		ST_AddBand(
> 			ST_AddBand(
> 				ST_MakeEmptyRaster(2, 2, 10, 10, 2, 2, 0, 0)
> 				, 1, '64BF', 1234.5678, NULL
> 			)
> 			, '64BF', 987.654321, NULL
> 		)
> 		, '64BF', 9876.
> 	)
> , 1)
> 
> returns FALSE
> 
> 2. SELECT ST_HasNoBand(
> 	ST_AddBand(
> 		ST_AddBand(
> 			ST_AddBand(
> 				ST_MakeEmptyRaster(2, 2, 10, 10, 2, 2, 0, 0)
> 				, 1, '64BF', 1234.5678, NULL
> 			)
> 			, '64BF', 987.654321, NULL
> 		)
> 		, '64BF', 9876.
> 	)
> , 4)
> 
> returns TRUE
> 
> 3. SELECT ST_HasNoBand(
> 	ST_AddBand(
> 		ST_AddBand(
> 			ST_AddBand(
> 				ST_MakeEmptyRaster(2, 2, 10, 10, 2, 2, 0, 0)
> 				, 1, '64BF', 1234.5678, NULL
> 			)
> 			, '64BF', 987.654321, NULL
> 		)
> 		, '64BF', 9876.
> 	)
> , 0)
> 
> returns FALSE
> 
> 4. SELECT ST_HasNoBand(
> 	ST_AddBand(
> 		ST_AddBand(
> 			ST_AddBand(
> 				ST_MakeEmptyRaster(2, 2, 10, 10, 2, 2, 0, 0)
> 				, 1, '64BF', 1234.5678, NULL
> 			)
> 			, '64BF', 987.654321, NULL
> 		)
> 		, '64BF', 9876.
> 	)
> , -1)
> 
> returns FALSE
> 
> Are the answers for #3 and #4 above correct?  I expected those to be TRUE as
> the band index of a raster are 1-based in PostgreSQL.
> 
> -bborie
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list