I have to find the count of the number of pixels in a given band of a clipped raster. For clipping, I am using ST_clip(). Through clip function raster is clipped with a polygon. I am getting following error
function st_clip(raster, integer, geometry) does not exist
I am not sure about the placements of the paranthesis.
SELECT ST_ValueCount(ST_Clip(rast,1,ST_Transform(ST_GeomFromText('POLYGON((76.36792879303643 13.633268921278498,77.64804272121083 13.625811445922459,77.58727436708882 12.839858067425443,76.54887536367008 12.766426303994999,76.36792879303643 13.633268921278498))',4326), 4326)),1,false) AS valuecount FROM raster_file;
Should I use ST_UNION before ST_clip as my raster file is tiled and then saved in postgis using 'raster2pgsql' command.
Otherwise please provide a proper example to clip a raster from polygon, and to find the valuecount.