Build Raster Attribute Table (Data Management)

License Level:BasicStandardAdvanced


Adds a raster attribute table to a raster dataset or updates an existing one.



BuildRasterAttributeTable_management (in_raster, {overwrite})
ParameterExplanationData Type

The input raster dataset.

This must be a raster dataset with only a single band. It is not possible to build a raster attribute table for a raster dataset that has a pixel type of floating point or double precision.

Raster Layer

This allows you to overwrite any existing raster attribute table that might exist.

  • NONEExisting raster attribute tables will not be overwritten, and any edits will be appended to the current table. This is the default.
  • OVERWRITEDelete the existing raster attribute tables and create a new raster attribute table.

Code Sample

BuildRasterAttributeTable example (Python window)

This is a Python sample for BuildRasterAttributeTable.

import arcpy
arcpy.BuildRasterAttributeTable_management("c:/data/image.tif", "Overwrite")
BuildRasterAttributeTable example 2 (stand-alone script)

This is a Python script sample for BuildRasterAttributeTable.

##Build Raster Attribute Table
##Usage: BuildRasterAttributeTable_management in_raster {NONE | Overwrite}
    import arcpy
    arcpy.env.workspace = r"C:/Workspace"
    ##Build attribute table for single band raster dataset
    ##Overwrite the existing attribute table file
    arcpy.BuildRasterAttributeTable_management("image.tif", "Overwrite")

    print "Build Raster Attribute Table example failed."
    print arcpy.GetMessages()


Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes