Problem: IZonalOp::ZonalStatistics fails when both a string field and a selection are used in RasterDescriptor


When calling the IZonalOp::ZonalStatistics method, if the zone is defined by a RasterDescriptor in which both a selection and a string field are used, the operation fails.


This is a known issue with ArcGIS 8.1.

Solution or Workaround

There are two solutions for this problem:

  • Convert the zone raster into a feature class using the Conversion function in the Spatial Analyst user interface. Then, create a FeatureDescriptor from the feature class just created, and pass the FeatureDescriptor to the operator.
  • Do the conversion and creation as two steps in VB code. First do a conversion with the selection using IConversionOp::ToRasterDataset. Next, create a RasterDescriptor using the output from the conversion with the string field only.