Available with Spatial Analyst license.
Summary
Combines multiple rasters so that a unique output value is assigned to each unique combination of input values.
Illustration
Usage
The Combine tool works on integer values and their associated attribute tables. If the values on the input are floating point, they will be automatically truncated, tested for uniqueness with the other input, and sent to the output attribute table.
The Combine tool is similar to the Combinatorial Or tool. They both assign a new number to each unique combination of input values.
No more than 20 rasters can be used as input to Combine.
If a cell location contains NoData on any of the input rasters, that location will be assigned NoData on the output.
-
The output raster is always of integer type.
For formats other than Esri Grid, by default, the output raster from this tool can only have a maximum of 65,536 unique values.
You can increase this number by changing a setting in ArcGIS. On the main menu, select Customize > ArcMap Options. In the ArcMap Options dialog box, click the Raster tab and modify the Maximum number of unique values to display field to an appropriate value.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
Combine (in_rasters)
Parameter | Explanation | Data Type |
in_rasters [in_raster,...] | The list of input rasters to be combined. | Raster Layer |
Return Value
Name | Explanation | Data Type |
out_raster | The output combined raster. A unique integer value is assigned to each unique combination of input values. | Raster |
Code Sample
Combine example 1 (Python window)
This example takes several input rasters in different formats (Grid, IMG, and TIFF) and outputs the unique combination values as a Grid raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outCombine = Combine(["filter", "zone", "source.img", "dec.tif"])
outCombine.save("C:/sapyexamples/output/outcombine2")
Combine example 2 (stand-alone script)
This example takes several input rasters in different formats (Grid, IMG, and TIFF) and outputs the unique combination values as a Grid raster.
# Name: Combine_Ex_02.py
# Description: Combines multiple rasters such that a unique value is
# assigned to each unique combination of input values
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster01 = "filter"
inRaster02 = "zone"
inRaster03 = "source.img"
inRaster04 = "dec.tif"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute Combine
outCombine = Combine([inRaster01,inRaster02,inRaster03,inRaster04])
# Save the output
outCombine.save("C:/sapyexamples/output/outcombine")
Environments
Licensing Information
- ArcGIS for Desktop Basic: Requires Spatial Analyst
- ArcGIS for Desktop Standard: Requires Spatial Analyst
- ArcGIS for Desktop Advanced: Requires Spatial Analyst