Skip To Content

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.

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