Combine

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

Learn more about how Combine works


Illustration

Combine illustration

Usage tips

Command line and Scripting

Map Algebra

ArcObjects

Syntax

Combine_sa (in_rasters, out_raster)
Parameter Explanation Datatype
Input rasters (Required)

The list of input rasters to be combined.

Composite Geodataset
Output raster (Required)

The raster to be created.

Raster Dataset
Data types for geoprocessing tool parameters

Script Example

# Combine_sample.py
# Description: 
#   Combines multiple rasters such that a unique output value is
#   assigned to each unique combination of input values.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005

# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
    # Set local variables
    outRaster = "C:/data/final_1"

    # Check out Spatial Analyst extension license
    gp.CheckOutExtension("Spatial")

    # Process: Combine...
    gp.Combine_sa("'C:/data/ras_1';'C:/data/ras_2'", outRaster)

except:
    # If an error occurred while running a tool, then print the messages.
    print gp.GetMessages()

Map Algebra syntax

Combine(<grid, ..., grid>)

Parameter Explanation
<grid> An input integer or floating-point raster or an expression resulting in a raster.

Map Algebra example

combine(ingrid1, ingrid2)
combine(ingrid1, ingrid2, ingrid3, ingrid4)
combine(ingrid1.pH, ingrid2, ingrid3.permeability, ingrid4)

ArcObjects syntax

ILocalOp::Combine (LocalData As IGeoDataset) As IGeoDataset

Parameter Explanation
LocalData A multiband Raster, RasterDataset, RasterBand, or RasterDescriptor.

ArcObjects example

' Create the RasterLocalOp object
Dim pLocalOp As ILocalOp                            
Set pLocalOp = New RasterLocalOp

' Declare the first input raster object
Dim pInputRaster1 As IRasterDataset

' Calls function to open the first raster dataset from disk
Set pInputRaster1 = OpenRasterDataset("D:\SpatialData", "inputraster1")

' Declare the second input raster object
Dim pInputRaster2 As IRasterDataset

' Calls function to open the second raster dataset from disk
Set pInputRaster2 = OpenRasterDataset("D:\SpatialData", "inputraster2")

' Create a raster bandcollection
Dim pRBCollection as IRasterBandCollection          
Set pRBCollection = New Raster              
pRBCollection.AppendBands pInputRaster1              
pRBCollection.AppendBands pInputRaster2      

' Declare the output raster object
Dim pOutputRaster As IRaster

' Calls the method
Set pOutputRaster = pLocalOp.Combine(pRBCollection)

See Also

  • Popularity
  • Rank
  • Cell Statistics
  • An overview of the Local tools