Skip to main content
Returns summary statistic for a particular band based on the statType parameter. The function defaults to band index of 1 when band is not specified and excludes noDataValue if excludeNoDataValue is not specified. statType parameter takes the following strings:
  • count: Total count of all pixels in the specified band
  • sum: Sum of all pixel values in the specified band
  • mean: Mean value of all pixel values in the specified band
  • stddev: Standard deviation of all pixels in the specified band
  • min: Minimum pixel value in the specified band
  • max: Maximum pixel value in the specified band
If excludeNoDataValue is set true then it will only count pixels with value not equal to the nodata value of the raster. Set excludeNoDataValue to false to get count of all pixels in raster.

Signatures

RS_SummaryStats(raster: Raster, statType: String, band: Integer = 1, excludeNoDataValue: Boolean = true)
RS_SummaryStats(raster: Raster, statType: String, band: Integer = 1)
RS_SummaryStats(raster: Raster, statType: String)

Parameters

raster
Raster
required
The input raster.
statType
String
required
The stat type value.
band
Integer
default:"1"
The band index.
excludeNoDataValue
Boolean
default:"true"
Whether to exclude NoData pixels from the calculation.

Return type

A numeric value.

Example

SELECT RS_SummaryStats(RS_MakeEmptyRaster(2, 5, 5, 0, 0, 1, -1, 0, 0, 0), "stddev", 1, false)
9.4678403028357