Skip To Content

Arithmetic function

The Arithmetic function performs an arithmetic operation between two rasters or a raster and a scalar and vice versa.

The inputs for this function are the following:

  • Input Raster 1
  • Input Raster 2
  • Operation
  • Cell Size
  • Extent

If you want to use a constant value for every pixel value in a raster, click the Raster drop-down arrow within the Generate raster from constant section of the dialog box and choose either Raster 1 or Raster 2. Then specify a value in the Constant text box.

If your input is a multiple-band raster, and you want to use a different constant value for each of the bands, you need to use the Generate raster from constant section. The Raster option needs to be set to Raster 2, and the Constant has the constant values for each of the bands, separated by a space, for example: 0.5 2 4 0.33.

Operations

The Operation options are as follows:

  • Plus—Outputs the sum of all the corresponding pixel values for each raster.
    output = Raster1 + Raster2
    Arithmetic function—Plus
  • Minus—Outputs the difference between the corresponding pixel values for each raster. This can be used to calculate change detection.
    output = Raster1 - Raster2
    Arithmetic function—Minus
  • Multiply—Outputs the product of the corresponding pixel values for each raster. This can be used to perform some cost functions.
    output = Raster1 × Raster2
    Arithmetic function—Multiply
  • Divide—Outputs the divisible result between the corresponding pixel values for each raster.
    output = Raster1 ÷ Raster2
  • Power—Outputs the product of the corresponding pixel values raised to the power of the input raster or scalar.
    output = Raster1Raster2
  • Mode—Outputs the pixel value of all overlapping pixels that occurs the most. For example, if there are six bands in a raster, there will be six overlapping pixels. For the values 4, 5, 6, 4, 7, 9, the mode value is 4.

Cell Size

Cell Size defines how to compute the cell size of the output when the input rasters have different cell sizes.

  • First—Defines the output cell size using the cell size of the first input raster.
  • Last—Defines the output cell size using the cell size of the last input raster.
  • Max—Defines the output cell size using the maximum cell size of the input rasters.
  • Mean—Defines the output cell size using the mean (average) of both input rasters.
  • Min—Defines the output cell size using the minimum cell size of the input rasters.

Extent

Extent defines how to compute the extent of the output when the input rasters have different extents.

  • First—Defines the output extent using the extent of the first input raster.
  • Last—Defines the output extent using the extent of the last input raster.
  • Intersection—Defines the output extent as the intersecting area of the input rasters.
  • Union—Defines the output extent as the total extent of the input rasters.

Input rastersExtent if FirstExtent if LastExtent if IntersectionExtent if Union

Input rasters

First extent

Last extent

Intersection extent

Union extent