Build Raster Attribute Table (Data Management)

Summary

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

Usage

Syntax

BuildRasterAttributeTable_management (in_raster, {overwrite})
ParameterExplanationData Type
in_raster

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
overwrite
(Optional)

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

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}
    
try:
    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")

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

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

10/27/2014