3

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 printed 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.

2 Answers 2

1

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.

0

The warning:

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

...is generated in the step prior to your forced creation of the attribute table. Due to the lack of context, I can't clarify that further for your specific case; however, in my situation, I covert a polygon feature class to a raster, using arcpy.PolygonToRaster_conversion. This is where warning 010367 is generated. If you subsequently use arcpy.BuildRasterAttributeTable_management on the raster, then you can just ignore the above warning.

Without seeing additional content from your script, I can't address your second error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.