Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

We are converting some polygon features to raster using ESRI.ArcGIS.GeoAnalyst.IConversionOp. The conversion is based on an integer field and the output raster is being correctly produced with integer type.

The output raster may have up to ~300k unique values and I need to build the attribute table so I can get the values and counts. Here is my code:

if (tRasProps.IsInteger)
{
    // set max number of zone values to some big-enough limit 
    int tMaxPermissibleZones = 1 + 2<<20;
    IRasterDefaultsEnv3 rasDSEnv = (IRasterDefaultsEnv3)Activator.CreateInstance(typeof(RasterDefaultsEnvClass));
    rasDSEnv.MaximumBuildAttributeTableSize = tMaxPermissibleZones;
    // build the attribute table
    IRasterDatasetEdit2 rasterDSEdit = (IRasterDatasetEdit2)tRasterDataset;
    rasterDSEdit.BuildAttributeTable();
}

Most of the time, this works just fine and IRaster2.AttributeTable on the associated raster object returns the attribute table. But occasionally it doesn't and the attribute table is null. (This code is running in a loop, with the raster in question being created from various subsets of the features in the source feature class. It runs fine for a while then suddenly the attribute table is null.) I haven't been able to pin down what makes it fail, but it certainly isn't that there are too many zones.

When it fails, if I look at the raster in ArcCatalog, there IS an attribute table in existence! But I can't get at it through ArcObjects! I have tried discarding the raster / rasterdataset objects and reopening from disk, but still no table. I have also tried creating the attribute table via the Geoprocessor. Same result.

Are there any known bugs with the raster attribute table creation? I am using version 9.2 (I know!).

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.