zone geometry. The struct has the following schema:
For polygon geometries, the allTouched parameter (Since v1.7.1) determines how pixels are selected:
- When true, pixel selection also includes cells entered by the polygon’s boundary, following the RS_AsRaster rules.
- When false (default), pixels whose centroid intersects the polygon will be included.
allTouched. Line rasterization follows the cells entered by its segments rather than requiring a pixel-centre intersection. A point or line lying on an internal grid edge selects the pixel after it in pixel order; one lying on the raster’s last edge selects none. A neighboring pixel contacted only at a line endpoint is not selected unless the segment enters it.
- count: Count of the pixels.
- sum: Sum of the pixel values.
- mean: Arithmetic mean.
- median: Median.
- mode: Mode.
- stddev: Standard deviation.
- variance: Variance.
- min: Minimum value of the zone.
- max: Maximum value of the zone.
If the coordinate reference system (CRS) of the input
zone geometry differs from that of the raster, then zone will be transformed to match the CRS of the raster before computation.The following conditions will throw an IllegalArgumentException if they are not met:- The provided
rasterandzonegeometry should intersect whenlenientparameter is set tofalse. - The option provided to
statTypeshould be valid.
lenient parameter is set to true by default. The function will return null if the raster and zone geometry do not intersect.Signatures
Parameters
Raster
required
The input raster.
Geometry
required
The zone value.
Integer
The band index.
Boolean
The all touched value.
Boolean
The exclude nodata value.
Boolean
The lenient value.
Return type
A struct containing the result fields.

