Add Colormap (Data Management)

License Level:BasicStandardAdvanced

Summary

Adds a new colormap or replaces an existing colormap on a raster dataset.

Usage

Syntax

AddColormap_management (in_raster, {in_template_raster}, {input_CLR_file})
ParameterExplanationData Type
in_raster

The raster dataset to add or replace a color map.

Raster Layer
in_template_raster
(Optional)

A raster dataset that has a colormap that you want to apply to the input raster dataset. If this is entered the input_CLR_file parameter cannot be specified.

Raster Layer
input_CLR_file
(Optional)

Specify a .clr or .act file to use as the colormap.

File

Code Sample

AddColormap example (Python window)

This is a Python sample for AddColormap.

import arcpy
arcpy.AddColormap_management("c:/data/nocolormap.img", "#",
                             "colormap_file.clr")
AddColormap example 2 (stand-alone script)

This is a Python script sample for AddColormap.

##====================================
##Add Colormap
##Usage: AddColormap_management in_raster {in_template_raster} {input_CLR_file}

try:
    import arcpy
    arcpy.env.workspace = r"C:/Workspace"
    
    ##Assign colormap using template image
    arcpy.AddColormap_management("nocolormap.img", "colormap.tif", "#")
    
    ##Assign colormap using clr file
    arcpy.AddColormap_management("nocolormap.img", "#", "colormap_file.clr")

except:
    print "Add Colormap example failed."
    print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015