Show Navigation | Hide Navigation

Minus

Release 9.2
Last modified January 3, 2008
E-mail This Topic Printable Version Give Us Feedback


Related Topics

Subtracts the value of the second input raster from the value of the first input raster on a cell-by-cell basis within the Analysis window.


Illustration

Minus illustration

Usage tips

Command line syntax
An overview of the Command Line window
Minus_sa <in_raster_or_constant1> <in_raster_or_constant2> <out_raster>

Parameter Explanation Data Type
<in_raster_or_constant1>

The input raster or constant value from which to subtract.

Composite Geodataset
<in_raster_or_constant2>

The input raster or constant value to subtract.

Composite Geodataset
<out_raster>

The raster to be created.

Raster Dataset
Data types for geoprocessing tool parameters


Command line example

Minus_sa C:/data/ras_1 C:/data/ras_2 C:/data/final_1

Scripting syntax
About getting started with writing geoprocessing scripts
Minus_sa (in_raster_or_constant1, in_raster_or_constant2, out_raster)

Parameter Explanation Data Type
in_raster_or_constant1 (Required)

The input raster or constant value from which to subtract.

Composite Geodataset
in_raster_or_constant2 (Required)

The input raster or constant value to subtract.

Composite Geodataset
out_raster (Required)

The raster to be created.

Raster Dataset

Data types for geoprocessing tool parameters


Script example

# Minus_sample.py
# Description: 
#   Subtracts the values of two rasters on a cell-by-cell basis.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005
# Import system modules
import arcgisscripting

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

try:
    # Set the input raster dataset
    inRaster1 = "C:/data/ras_1"
    inRaster2 = "C:/data/ras_2"

    # Set the output raster name
    outRaster = "C:/data/final_1"

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

    # Process: Minus
    gp.Minus_sa(inRaster1, inRaster2, outRaster)

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

Map Algebra syntax
See -

ArcObjects syntax
IMathOp::Minus (geoDataset1 As IGeoDataset, geoDataset2 As IGeoDataset) As IGeoDataset

Parameter Explanation
geoDataset1 The input Raster, RasterDataset, RasterBand, or RasterDescriptor from which to subtract.
geoDataset2 The input Raster, RasterDataset, RasterBand, or RasterDescriptor to subtract.

ArcObjects example

' Create the MathOps object
Dim pMathOp As IMathOp
Set pMathOp = New RasterMathOps

' Declare the input geoDataset1 object
Dim pInputDataset1 As IGeoDataset

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

' Declare the input geoDataset2 object
Dim pInputDataset2 As IGeoDataset

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

' Declare the output raster object
Dim pOutputRasterAs IGeoDataset

' Calls the method
Set pOutputRaster = pMathOp.Minus (pInputDataset1, pInputDataset2)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.