Combine (Spatial Analyst)

Summary

Combines multiple rasters so that a unique output value is assigned to each unique combination of input values.

Illustration

Combine illustration
OutRas = Combine([InRas1, InRas2])

Usage

Syntax

Combine (in_rasters)
ParameterExplanationData Type
in_rasters
[in_raster,...]

The list of input rasters to be combined.

Raster Layer

Return Value

NameExplanationData 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 an ESRI 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 an ESRI 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
# Author: ESRI

# 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

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst
ArcEditor: Requires Spatial Analyst
ArcInfo: Requires Spatial Analyst

6/29/2011