ST_DumpValues — Get the values of the specified band as a 2-dimension array.
setof record ST_DumpValues(
raster rast
,
integer[] nband
,
boolean exclude_nodata_value=true
)
;
double precision[][] ST_DumpValues(
raster rast
,
integer nband
,
boolean exclude_nodata_value=true
)
;
Get the values of the specified band as a 2-dimension array. If nband
is NULL or not provided, all raster bands are processed.
Availability: 2.1.0
WITH foo AS ( SELECT ST_AddBand(ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 1, 0), 2, '32BF', 3, -9999), 3, '16BSI', 0, 0) AS rast ) SELECT (ST_DumpValues(rast)).* FROM foo; nband | valarray -------+------------------------------------------------------ 1 | {{1,1,1},{1,1,1},{1,1,1}} 2 | {{3,3,3},{3,3,3},{3,3,3}} 3 | {{NULL,NULL,NULL},{NULL,NULL,NULL},{NULL,NULL,NULL}} (3 rows)
WITH foo AS ( SELECT ST_AddBand(ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 1, 0), 2, '32BF', 3, -9999), 3, '16BSI', 0, 0) AS rast ) SELECT (ST_DumpValues(rast, ARRAY[3, 1])).* FROM foo; nband | valarray -------+------------------------------------------------------ 3 | {{NULL,NULL,NULL},{NULL,NULL,NULL},{NULL,NULL,NULL}} 1 | {{1,1,1},{1,1,1},{1,1,1}} (2 rows)