ArcObjects Library Reference (SpatialAnalyst)  

IZonalOp.ZonalStatistics Method

Calculates in each output cell the statistic of the values of all cells in the value raster that belongs to the same zone.

[Visual Basic .NET]
Public Function ZonalStatistics ( _
    ByVal zone As IGeoDataset, _
    ByVal value As IGeoDataset, _
    ByVal Type As esriGeoAnalysisStatisticsEnum, _
    ByVal ignoreNoData As Boolean _
) As IGeoDataset
[C#]
public IGeoDataset ZonalStatistics (
    IGeoDataset zone,
    IGeoDataset value,
    esriGeoAnalysisStatisticsEnum Type,
    bool ignoreNoData
);
[C++]
HRESULT ZonalStatistics(
  IGeoDataset* zone,
  IGeoDataset* value,
  esriGeoAnalysisStatisticsEnum Type,
  VARIANT_BOOL ignoreNoData,
  IGeoDataset** statisticsGeoDataset
);
[C++]

Parameters

zone [in]

  zone is a parameter of type IGeoDataset

value [in]

  value is a parameter of type IGeoDataset

Type [in]

  Type is a parameter of type esriGeoAnalysisStatisticsEnum

ignoreNoData [in]   ignoreNoData is a parameter of type VARIANT_BOOL statisticsGeoDataset [out, retval]

  statisticsGeoDataset is a parameter of type IGeoDataset

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Spatial Analyst Extension.

Remarks

zone an input Raster, RasterDataset, RasterBand, or RasterDescriptor or FeatureClass, FeatureClassDescriptor that identifies the zone for each cell location
value an input integer or floating-point Raster, RasterDataset, RasterBand, or RasterDescriptor defining the values of the cells that are to be used in the zonal calculations
type an esriGeoAnalysisStatisticsEnum defining the zonal statitistic to calculate within each zone

The enumeration types are:

esriGeoAnalysisStatsMajority for the majority value, esriGeoAnalysisStatsMaximum for the maximum value, esriGeoAnalysisStatsMean for the mean, esriGeoAnalysisStatsMedian for the median, esriGeoAnalysisStatsMinimum for the minimum value, esriGeoAnalysisStatsMinority for the minority value, esriGeoAnalysisStatsRange for the range of values, esriGeoAnalysisStatsStd for the standard deviation, esriGeoAnalysisStatsSum for the sum of the values, or esriGeoAnalysisStatsVariety for the variety of the values.

ignoreNoData a Boolean defining the manner in which NoData values on the valueDataset that fall within a zone defined by the zoneDataset will influence the output results

If True, then if a NoData value exists in a cell on the value Raster within any particular zone defined by zoneDataset, the cell will be ignored and only cells on the value Raster that have data values within the zone will be used in the processing for the output.

If False, then if a NoData value exists on the value Raster within any particular zone defined by zoneDataset, there is insufficient information to complete the computation of the values for all of the cells within the zone, therefore, the entire zone will receive the NoData value on the output Raster and will not appear in the output table.

See Also

IZonalOp Interface