Minus |
|
Release 9.2
Last modified January 3, 2008 |
|
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
Usage tips
Command line and Scripting
The order of input is relevant in the subtraction expression.
If both input values are integers, the output values will be integers; otherwise, the output will be a floating-point value.
A number can be used as an input; however, the cell size and extent must first be set in the environment.
The following environment settings affect this tool:
ArcObjects
The order of input is relevant in the subtraction expression.
If both input values are integer, the output values will be integer; otherwise, the output will be floating point.
The output from the ArcObjects method is a raster object.
A number cannot be used as input to the ArcObjects method. If a constant number must be passed to the method, create a constant raster using IRasterMakerOp::MakeConstant, then pass the results to the method.
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 |
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 |
# 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. |
' 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)