This function calculates the statistics about a band set of a raster object.
Syntax
raster ST_SummaryStats(raster raster_obj)
raster ST_SummaryStats(raster raster_obj, cstring statsOption)
raster ST_SummaryStats(raster raster_obj,
cstring bands,
cstring statsOption)
Parameters
Parameter | Description |
---|---|
raster_obj | The name of the raster object. |
bands | The sequence numbers of the bands. The value of this parameter can be an array of integers or an integer range. The integers start from 0. Examples: '0' , '1-3' , and '1,2,3' . |
statsOptions | The JSON string to specify the statistics that you want to calculate. |
The following table describes the parameter that is contained in the value of the statsOptions parameter.
Parameter | Description | Type | Format | Default value | Remarks |
---|---|---|---|---|---|
approx | Specifies whether to use the sampling method to calculate statistics. | boolean | None | true |
|
Examples
DO $$
declare
rast raster;
begin
select raster_obj into rast from raster_table where id = 1;
rast = ST_SummaryStats(rast);
update raster_table set raster_obj = rast where id = 1;
end;
$$ LANGUAGE 'plpgsql';