ArcGIS Raster Calculator: Use Con to Replace High Values
Simulate the powerful ‘Con’ (Conditional) tool from ArcGIS to conditionally replace raster values.
What is an arcgis raster calculator use con to replace high values?
In the world of Geographic Information Systems (GIS), the arcgis raster calculator use con to replace high values refers to a fundamental data manipulation technique. It uses the Spatial Analyst ‘Con’ (Conditional) tool, which functions like an “if-then-else” statement for every single cell in a raster dataset. A raster is a grid of cells, where each cell has a value representing a specific characteristic, such as elevation, temperature, or land cover type. This process allows a GIS analyst to selectively identify cells with high values (e.g., high elevations, high temperatures) and replace them with a new, specified value, while leaving all other cells unchanged. This is a crucial step in data cleaning, reclassification, and suitability modeling.
The ‘Con’ Formula for Replacing High Values
The core logic of this operation can be simplified into a clear formula that the Raster Calculator understands. The syntax for the Con tool is: `Con(in_conditional_raster, in_true_raster_or_constant, {in_false_raster_or_constant})`. For the specific task of replacing high values, the formula looks like this:
Output_Value = Con(Input_Raster > Threshold_Value, Replacement_Value, Input_Raster)
This expression tells ArcGIS to look at each cell in the `Input_Raster`. If a cell’s value is greater than the `Threshold_Value`, it assigns the `Replacement_Value` to the output raster at that location. If the condition is false (the cell’s value is not greater than the threshold), it simply carries over the original cell value from the `Input_Raster` to the output. Our ArcGIS conditional tool calculator above simulates this exact process for a single cell.
| Variable | Meaning | Unit | Typical Range |
|---|---|---|---|
| Input_Raster | The source raster dataset containing the values to be evaluated. | Unitless (or inherent to the data, e.g., meters, degrees Celsius) | Varies widely based on data type (e.g., -400 to 8848 for elevation) |
| Threshold_Value | The numeric constant used to define what constitutes a ‘high value’. | Same as Input_Raster | A specific value within the input raster’s range. |
| Replacement_Value | The numeric constant that will replace the original values where the condition is true. | Unitless | Any number; often a specific code or a ‘NoData’ value like -9999. |
Practical Examples
To better understand the arcgis raster calculator use con to replace high values process, let’s consider two realistic scenarios.
Example 1: Masking High-Elevation Areas
- Inputs:
- Input Raster Value (representing elevation): 2150 meters
- Threshold Value: 2000 meters
- Replacement Value (a NoData value): -9999
- Logic:
Con("elevation_raster" > 2000, -9999, "elevation_raster") - Result: Since 2150 is greater than 2000, the output cell value is -9999. This effectively removes or ‘masks’ this high-elevation area from further analysis, a common step in raster reclassification.
Example 2: Classifying Extreme Heat Zones
- Inputs:
- Input Raster Value (representing temperature): 41°C
- Threshold Value: 40°C
- Replacement Value (a classification code): 1
- Logic:
Con("temp_raster" > 40, 1, "temp_raster") - Result: Because 41 is greater than 40, the output value is 1. All cells with temperatures below 40°C would retain their original temperature values. This creates a new raster where ‘1’ signifies an extreme heat zone.
How to Use This ‘Con’ Tool Calculator
Our calculator simplifies the complex ArcGIS environment into an easy-to-use tool to help you learn the logic.
- Enter the Input Raster Value: Type in the numerical value of the raster cell you want to test. This represents a single pixel from your dataset.
- Set the Threshold Value: Define the cutoff point. Any input value *above* this number will be considered “high”.
- Define the Replacement Value: Enter the number you want to use for replacement. This is often a code (like 1, 2, 3) or a NoData value (-9999 is common).
- Interpret the Results: The calculator instantly shows you the “Output Raster Value”. It also explains in plain English whether the condition was met and why the output value was chosen. The bar chart provides a quick visual reference for the three values. For more advanced operations, see our spatial analyst tutorial.
Key Factors That Affect ‘Con’ Tool Usage
- Data Type: The Con tool works on both integer and floating-point rasters. The output data type will depend on the inputs.
- NoData Values: Cells that contain NoData in the input conditional raster will always be NoData in the output. Understanding how to handle these is key. You can even use a nested Con statement with the `IsNull()` tool to specifically target and replace NoData values.
- The “False” Statement: In our example, the false condition returns the original raster’s value. However, in ArcGIS, you could also provide a different constant or even a different raster for the false condition, offering immense flexibility.
- Complex Expressions: The condition doesn’t have to be a simple “greater than.” You can build complex queries using multiple criteria with AND/OR operators (e.g., `(VALUE > 1000) & (VALUE < 1500)`).
- Processing Extent: When working with multiple rasters in ArcGIS, you must be aware of your analysis environment settings, especially the Processing Extent, which defines the area the tool will operate on.
- Raster Resolution (Cell Size): While not directly affecting the `Con` logic, the cell size determines the level of detail in your raster and thus the granularity of your analysis.
Frequently Asked Questions (FAQ)
What does ‘Con’ stand for?
‘Con’ is short for Conditional. It performs a conditional if/else evaluation on each cell of an input raster.
Why would I replace high values instead of just selecting them?
Replacing values is a form of reclassification. You might replace them with a ‘NoData’ value to exclude them from calculations (like averaging) or with a ‘1’ to create a binary mask for use in a subsequent suitability model, which is a core part of raster math.
Can the replacement value be another raster?
Yes. In a full ArcGIS environment, the ‘true’ and ‘false’ arguments can be constants or other rasters. This allows for very powerful cell-by-cell logic, like `Con(rasterA > 5, rasterB, rasterC)`, which would take values from rasterB or rasterC depending on rasterA.
What happens if I don’t provide a ‘false’ value?
If you omit the `{in_false_raster_or_constant}` in ArcGIS, any cell that evaluates to false will be assigned a NoData value in the output raster.
How is this different from the ‘Reclassify’ tool?
The ‘Reclassify’ tool is better for changing many different values or ranges of values at once. The `Con` tool is more flexible for building custom if/then logic, especially conditions involving more than one raster. Using arcgis raster calculator use con to replace high values is often faster for a single, simple condition.
What is a ‘NoData’ value?
It’s a special value used to represent the absence of data for a particular cell. Operations often treat these cells differently (e.g., ignoring them). Using a value like -9999 is a common convention.
Can I use this logic on vector data (points, lines, polygons)?
No, the Raster Calculator and the `Con` tool are designed specifically for raster data. Vector data uses different tools, like ‘Select Layer By Attribute’, to perform conditional selections.
How can I replace a specific value, not just high values?
You can simply change the operator. To replace a specific value (e.g., 50), your expression would be `Con(“your_raster” == 50, replacement_value, “your_raster”)`. You can find workflows for this on the Esri Support site.
Related Tools and Internal Resources
- Introduction to Raster Data: A primer on the fundamental data model used in this process.
- ArcGIS Pro Tips: Advanced guides for leveraging tools in ArcGIS Pro.
- Set Null in Raster Calculator: Learn about the ‘Set Null’ tool, another conditional operator for setting NoData values.
- ArcPy Con Tool Guide: A developer’s guide to using the Con tool in Python scripts for ArcGIS.