How to Use Raster Calculator in ArcGIS Pro
The Raster Calculator in ArcGIS Pro is a powerful tool for performing raster algebra, allowing you to create new raster datasets by applying mathematical and logical operations to existing ones. This guide will walk you through its fundamental usage, explaining common operations and providing practical examples.
Raster Calculator Input & Output
Calculation Preview
N/A
N/A
N/A
Raster Calculator Formula and Mathematical Explanation
The “formula” in the Raster Calculator is actually a user-defined raster expression. This expression dictates how cell values from one or more input rasters are combined to produce a new output raster. The core principle is cell-by-cell processing, where the operation is applied independently to corresponding cells across the input datasets.
Supported Operators and Functions
ArcGIS Pro’s Raster Calculator supports a wide range of operators and functions, including:
- Arithmetic Operators: +, -, *, /
- Comparison Operators: ==, !=, >, <, >=, <=
- Logical Operators: &, |, ~ (AND, OR, NOT)
- Mathematical Functions: ABS(), ACOS(), ASIN(), ATAN(), CEILING(), COS(), EXP(), FLOOR(), LOG(), LOG10(), ROUND(), SIN(), SQRT(), TAN(), TRUNC()
- Conditional Functions: CON() – allowing for IF-THEN-ELSE logic.
- Raster-Specific Functions: EucDistance, FlowDirection, etc. (depending on the ArcGIS Pro license and tool availability).
Variable Explanations
In the context of the Raster Calculator, variables typically refer to the input rasters or specific cell values within those rasters. Common notations include:
$inputRaster1,$inputRaster2, etc.: Placeholders for your input rasters.Cell Value: Represents the actual numerical value within a cell of a raster.
Example Expression Breakdown: $inputRaster1 + $inputRaster2 * 0.5
- $inputRaster1: Refers to the cell values of the first raster provided.
- $inputRaster2: Refers to the cell values of the second raster provided.
- *: Multiplication operator.
- +: Addition operator.
- 0.5: A constant multiplier.
For any given cell location (e.g., row 10, column 5), the calculation would be: Value from inputRaster1 at (10,5) + (Value from inputRaster2 at (10,5) * 0.5).
Variables Table
| Variable/Term | Meaning | Unit | Typical Range / Example |
|---|---|---|---|
| Input Raster Path | File location of the raster dataset. | File Path | C:/gis/dem.tif |
| $inputRasterN | Placeholder for the Nth input raster’s cell values. | Raster Value Units (e.g., meters, degrees, count) | Elevation (meters), Temperature (Celsius), Land Cover Code (Integer) |
| Constants | Fixed numerical values used in calculations. | Unitless or matching raster units | 0.5, 10, -5 |
| Operators (+, -, *, /) | Mathematical operations performed on cell values. | Dependent on raster units | N/A |
| Functions (e.g., SQRT(), CON()) | Pre-defined mathematical or logical operations. | Dependent on function and raster units | N/A |
| Output Raster Name | Name assigned to the newly created raster file. | File Name | processed_data |
Practical Examples (Real-World Use Cases)
Example 1: Weighted Overlay for Suitability Analysis
Scenario: Identifying suitable areas for a new park based on proximity to water (favoring closer areas) and elevation (favoring lower elevations).
- Input Raster 1 (Proximity to Water): A distance raster derived from water bodies. Values are distance in meters. Higher values mean further away.
- Input Raster 2 (Elevation): A Digital Elevation Model (DEM). Values are elevation in meters.
- Expression:
($inputRaster1 * 0.7) + ($inputRaster2 * 0.3) - Explanation: We want to minimize distance to water and minimize elevation. The expression calculates a weighted sum. Areas with low distance to water (small $inputRaster1 value) and low elevation (small $inputRaster2 value) will result in lower overall scores, indicating higher suitability (assuming lower scores are better). The weights (0.7 and 0.3) indicate that proximity to water is considered more important.
- Output Raster Name:
park_suitability - Interpretation: The resulting `park_suitability` raster shows varying suitability scores. Areas with the lowest scores are the most suitable for the park according to the defined criteria. You would typically reclassify this raster to define specific suitability classes (e.g., High, Medium, Low).
Example 2: Calculating Change in Temperature Over Time
Scenario: Analyzing the difference in average temperature between two time periods.
- Input Raster 1 (Temperature Year 1): Average temperature raster for 2022. Values in Celsius.
- Input Raster 2 (Temperature Year 2): Average temperature raster for 2023. Values in Celsius.
- Expression:
$inputRaster2 - $inputRaster1 - Explanation: This is a simple subtraction. For each cell, the temperature of Year 1 is subtracted from the temperature of Year 2.
- Output Raster Name:
temp_change_2023_vs_2022 - Interpretation: The output raster shows positive values where temperatures increased, negative values where they decreased, and zero where they remained the same. This helps visualize warming or cooling trends across the study area.
Example 3: Conditional Raster Creation (Land Cover Masking)
Scenario: Creating a raster that only includes values from a precipitation raster where the land cover is ‘Forest’.
- Input Raster 1 (Precipitation): Precipitation raster. Values in mm.
- Input Raster 2 (Land Cover): Land cover classification raster. Assume ‘Forest’ has a code of 5.
- Expression:
Con($inputRaster2 == 5, $inputRaster1, Null()) - Explanation: The
Con()function acts as an IF-THEN-ELSE statement.- Condition:
$inputRaster2 == 5(Is the land cover code equal to 5?) - True Value:
$inputRaster1(If TRUE, use the precipitation value from Input Raster 1). - False Value:
Null()(If FALSE, set the cell value to NoData).
- Condition:
- Output Raster Name:
forest_precipitation - Interpretation: The resulting `forest_precipitation` raster will contain precipitation values only for cells classified as forest. All other cells will be NoData, effectively masking out non-forest areas.
How to Use This Raster Calculator Helper
This calculator provides a simplified interface to preview common Raster Calculator operations. Follow these steps:
- Enter Input Raster Paths: In the “Input Raster 1” and “Input Raster 2” fields, provide the complete file paths to your raster datasets. Ensure these rasters are accessible by ArcGIS Pro and have compatible spatial reference systems and extents for the intended analysis.
- Define Your Expression: In the “Raster Expression” field, type the formula you want to apply. Use
$inputRaster1and$inputRaster2as placeholders for your input rasters. You can include standard arithmetic operators (+, -, *, /), comparison operators, logical operators, and many built-in raster functions. Refer to the ArcGIS Pro documentation for a full list of supported functions. - Specify Output Name: Enter a descriptive name for your output raster file in the “Output Raster Name” field. The calculator will simulate the output path.
- Calculate & Preview: Click the “Calculate & Preview” button. The tool will attempt to validate your inputs and expression, then display a simulated output path, identify the primary operation type, and show calculated intermediate values based on simplified assumptions.
- Reset: If you need to start over, click the “Reset” button to clear all fields and revert to default values.
- Copy Results: Use the “Copy Results” button to copy the simulated output path, operation type, and intermediate values to your clipboard for easy pasting elsewhere.
Note: This helper is for previewing and understanding expressions. For actual execution, you will use the Raster Calculator tool within ArcGIS Pro, providing the same inputs and expressions.
Key Factors That Affect Raster Calculator Results
- Spatial Resolution: The cell size of your input rasters significantly impacts results. Operations on rasters with different resolutions can lead to resampling issues or inaccurate cell-to-cell comparisons if not handled properly (e.g., using a common cell size and extent).
- Coordinate System and Extent: Input rasters must share a compatible coordinate system and overlapping extent for meaningful cell-by-cell calculations. Mismatches require reprojection or clipping, which should ideally be done before using the Raster Calculator.
- Data Type and NoData Values: The data type of the input rasters (e.g., integer, float) affects precision and the range of possible output values. Ensure that NoData values are handled correctly in your expressions to avoid propagating errors. Using functions like
IsNoData()or theCon()function can help manage NoData. - Complexity of the Expression: Highly complex expressions with multiple nested functions or layers increase the potential for errors. It’s often best practice to break down complex analyses into sequential steps, using intermediate rasters.
- Operator Precedence: Understand the order of operations (similar to standard mathematics: Parentheses, Exponents, Multiplication/Division, Addition/Subtraction). Use parentheses
()to explicitly define the order of calculations within your expression, especially when mixing operators. - Scale and Units: Ensure that the units of your input rasters are consistent or that your expression accounts for the differences. For instance, adding a temperature raster (Celsius) to a precipitation raster (mm) without conversion would yield a meaningless result.
- ArcGIS Pro License Level: Certain advanced raster functions might require specific ArcGIS Pro license levels (e.g., Advanced).
Related Tools and Internal Resources
-
ArcGIS Pro Spatial Analyst Guide
Explore the capabilities of the Spatial Analyst extension in ArcGIS Pro.
-
Understanding Raster Data Types
Learn about different raster formats and their properties.
-
ArcGIS Pro Geoprocessing Tools
A general overview of the geoprocessing framework in ArcGIS Pro.
-
Map Algebra Tutorial
Step-by-step tutorials on applying map algebra techniques.
-
Using Conditional Statements in ArcGIS
Detailed explanation of the CON function and conditional logic.
-
Raster Reclassification Methods
Techniques for modifying raster value ranges.
Frequently Asked Questions (FAQ)
- Q1: What is the difference between the Raster Calculator tool and ModelBuilder in ArcGIS Pro?
- The Raster Calculator is a geoprocessing tool for performing single raster algebra operations using a text-based expression. ModelBuilder allows you to create visual workflows, chaining multiple tools (including Raster Calculator) together, incorporating data management, iteration, and more complex logic.
- Q2: Can I use the Raster Calculator with rasters that have different cell sizes?
- Yes, but ArcGIS Pro will automatically resample the rasters to a common cell size and extent during the calculation. This can introduce artifacts or inaccuracies. It’s best practice to set a common cell size and extent beforehand using tools like “Resample” or “Project” if precise control is needed.
- Q3: How do I handle NoData values in my calculations?
- By default, most operations involving a NoData value will result in NoData for that cell. You can explicitly manage NoData using the
IsNoData()function combined with theCon()function to assign a specific value or leave it as NoData based on conditions. - Q4: What does the `Con()` function do?
- The
Con()function implements a conditional (IF-THEN-ELSE) logic. Its syntax isCon(condition, true_value, false_value). For example,Con($inputRaster1 > 100, 1, 0)will output 1 for cells where$inputRaster1is greater than 100, and 0 otherwise. - Q5: Can I perform complex spatial analysis like suitability modeling directly in the Raster Calculator?
- While you can perform basic weighted sums or conditional selections, complex multi-criteria suitability analysis is often better handled using the Weighted Overlay or Suitability Modeler tools, or by chaining multiple Raster Calculator operations within ModelBuilder.
- Q6: How do I save the output of the Raster Calculator?
- When you run the Raster Calculator tool in ArcGIS Pro, you specify an output raster name and location. The tool then creates a new raster file based on your expression.
- Q7: What happens if my expression is invalid?
- If the expression syntax is incorrect or uses unsupported functions/variables, ArcGIS Pro will return an error message indicating the problem, often highlighting the problematic part of the expression.
- Q8: Can I use the Raster Calculator for logical operations (AND, OR, NOT)?
- Yes, you can use logical operators like
&(AND),|(OR), and~(NOT) to combine boolean rasters or create conditions. For example,($rasterA > 50) & ($rasterB < 10)creates a raster where cells are true only if the value in$rasterAis greater than 50 AND the value in$rasterBis less than 10.
Raster Operation Visualization
Input Series 2
This chart provides a conceptual visualization of how input raster values might combine based on the chosen expression. Actual values depend on your specific raster data.