views:

57

answers:

1

I have a python script that makes an attribute table of a raster. This runs through all the rasters that I have which are floats, converts them to ints, then makes an attribute table.

On the first 3 rasters, I get a warning message,

Value range for c:\raster2 exceeds 100000 and number of unique values exceeds 500.
Please use BUILDVAT if a VAT is required.

but an attribute table is generated. After this, however the program crashes and I don't know how to fix it. This is the error message printer to screen:

Value range for c:\raster2 exceeds 100000 and number of unique values exceeds 500.
Please use BUILDVAT if a VAT is required.
Traceback (most recent call last):
  File "LEED_raster_attribute.py", line 50, in <module>
    make_attribute( 20, 'C:\\Analysis\\Raster_Distances\\city' )
  File "Raster_attribute.py", line 40, in make_attribute
    gp.BuildRasterAttributeTable_management(outRaster)
arcgisscripting.ExecuteError: ERROR 000521: The number of unique values exceeds the limit.
Failed to execute (BuildRasterAttributeTable).

Googling the error message does not help, nor do the help files. Are there any solutions to this problem?

Thanks.

A: 

For grids, a raster attribute table is built by default for any integer grid that results from an expression if the range of values in the raster is less than 100,000 or if the number of unique values in the raster is less than 500. If the range is less than 100,000, the number of unique values in the raster can be as large as 100,000. If the range is greater than 100,000, a raster attribute table will still be built if the number of unique values is less than 500. If the range of values is greater than 100,000 and the number of unique values is greater than 500, then a raster attribute table is not automatically built. By default, the size of a raster attribute table is limited to 65,535 unique values. You can increase this number on the Options dialog box by clicking the Raster Attribute Table tab on the Raster tab.

I just re-read the raster documentation, and it is possible to manually increase the value that allows attribute tables to be constructed using the GUI. I manually entered a huge value and my script worked.


Not certain if this question/answer is useful. I'll leave it here for a day or two and see.

celenius