ST_Count — Returns the number of pixels in a given band of a raster or raster coverage. If no band is specified defaults to band 1. If exclude_nodata_value is set to true, will only count pixels that are not equal to the nodata value.
bigint ST_Count(
raster rast, integer nband=1, boolean exclude_nodata_value=true)
;
bigint ST_Count(
raster rast, boolean exclude_nodata_value)
;
bigint ST_Count(
text rastertable, text rastercolumn, integer nband=1, boolean exclude_nodata_value=true)
;
bigint ST_Count(
text rastertable, text rastercolumn, boolean exclude_nodata_value)
;
Returns the number of pixels in a given band of a raster or raster coverage. If no band is specified nband
defaults to 1.
If |
Availability: 2.0.0
The ST_Count(rastertable, rastercolumn, ...) variants are deprecated as of 2.2.0. Use ST_CountAgg instead. |
--example will count all pixels not 249 and one will count all pixels. -- SELECT rid, ST_Count(ST_SetBandNoDataValue(rast,249)) As exclude_nodata, ST_Count(ST_SetBandNoDataValue(rast,249),false) As include_nodata FROM dummy_rast WHERE rid=2; rid | exclude_nodata | include_nodata -----+----------------+---------------- 2 | 23 | 25