Summary
Create or update a table with information about the classes in your raster datasets. This is used primarily with discrete data.
Usage
If you want to delete an existing table and create a new one, check Overwrite (overwrite = 'OVERWRITE' in Python). A new raster attribute table will be created, and the old one will be deleted.
If you have an existing table and you do not check Overwrite, the table will be updated. No fields will be deleted, but the values in the table will be up to date.
It is not possible to build a raster attribute table for a raster dataset that is a pixel type of 32-bit floating point.
Syntax
BuildRasterAttributeTable(in_raster, {overwrite})
Parameter | Explanation | Data Type |
in_raster | Select a single band raster dataset that you want to add a table to. This tool will not run if the pixel type is floating point or double precision. | Raster Layer |
overwrite (Optional) | This allows you to overwrite or append columns and rows to an existing raster attribute table.
| Boolean |
Derived Output
Name | Explanation | Data Type |
out_raster | The output raster dataset. | Raster Layer |
Code sample
BuildRasterAttributeTable example (Python window)
This is a Python sample for the BuildRasterAttributeTable tool.
import arcpy
arcpy.BuildRasterAttributeTable_management("c:/data/image.tif", "Overwrite")
BuildRasterAttributeTable example 2 (stand-alone script)
This is a Python script sample for tbe BuildRasterAttributeTable tool.
##====================================
##Build Raster Attribute Table
##Usage: BuildRasterAttributeTable_management in_raster {NONE | Overwrite}
import arcpy
arcpy.env.workspace = "C:/Workspace"
##Build attribute table for single band raster dataset
##Overwrite the existing attribute table file
arcpy.BuildRasterAttributeTable_management("image.tif", "Overwrite")
Environments
This tool does not use any geoprocessing environments.
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes