Con function

Available with Image Analyst license.

Available with Spatial Analyst license.

Overview

Sets the pixels of the output raster based on an if\else evaluation of each input pixel. It returns pixel values from the True Raster if the conditional evaluation is true (1) or returns the pixel values from the False Raster if the conditional evaluation is false (0). This criteria is specified by the output of a logical math function, which will be the input Raster.

The Con function must be proceeded by a Math: Logical function, such as the Greater Than function. The output from the logical function is a Boolean raster (values of 1 and 0). When using the Con function, all values of 1 will be set to the True Raster and all values of 0 will be set to the False Raster values.

Con function description

Learn more about performing conditional evaluation with Con

Notes

If either the True Raster or the False Raster is a floating point, the output raster will be a floating point. If both the True Raster and the False Raster are integer, the output will be integer.

If no True Raster or constant is specified, NoData will be assigned to those cells that do not result in the true expression.

If there are any NoData pixels in the inputs, it remains NoData in the output.

If the Raster is a single band raster and either the True Raster or the optional False Raster is a constant, the output will be a single band raster.

If all inputs are multiband rasters, the output will be a multiband raster. The output raster will also be multiband if either the true input or the optional false input is a constant. The number of bands in each multiband input must be the same.

The function will perform the operation on each band from the conditional raster using the corresponding band from the other inputs. If the conditional input is a multiband raster and the true or false raster input is a constant, the function will perform the operation using the constant value for each band in the multiband input.

Parameters

Parameter nameDescription

Raster

The input raster that represents the Boolean result of a logical math raster function. The values will be either 1 (for true) or 0 (for false). It can be an integer or a floating-point raster.

True Raster

The input whose values will be used as the output pixel values if the condition is true. It can be an integer, a floating-point raster, or a constant value.

False Raster

The input whose values will be used as the output pixel values if the condition is false. It can be an integer, a floating-point raster, or a constant value.

Extent Type

Choose which extent should be used in the output raster:

  • First Of—Use the extent of the first input raster to determine the processing extent.

  • Intersection Of—Use the extent of the overlapping pixels to determine the processing extent. This is the default.
  • Union Of—Use the extent of all the rasters to determine the processing extent.
  • Last Of—Use the extent of the last input raster to determine the processing extent.

Cellsize Type

Choose which cell size to use in the output raster. If all the input cell sizes are the same, all the options will yield the same results.

  • First Of—Use the first cell size of the input rasters.
  • Min Of—Use the smallest cell size of all the input rasters.
  • Max Of—Use the largest cell size of all the input rasters. This is the default.
  • Mean Of—Use the mean cell size of all the input rasters.
  • Last Of—Use the last cell size of the input rasters.

Related topics


In this topic
  1. Overview
  2. Notes
  3. Parameters