Compute Change Raster (Image Analyst)

Available with Image Analyst license.

Summary

Calculates the absolute, relative, categorical, or spectral difference between two raster datasets.

Usage

  • This tool compares two rasters and generates a new raster containing the difference between the two. For example, use this tool to find out how carbon storage pixel values have changed between 2001 and 2020 or to see how land cover has changed from 2010 to 2015.

  • The following calculation types are available to compute the change raster:

    • Difference—The mathematical difference, or subtraction, between the pixel values in the From Raster parameter and the pixel values in the To Raster parameter.

      Output = (To Raster) - (From Raster)

    • Relative difference—The difference in pixel values accounting for the quantities of the values being compared.

      Output = (To Raster - From Raster) / max(To Raster, From Raster)

    • Categorical difference—The difference between two categorical or thematic rasters in which the output shows every class transition that occurred between the two rasters.
    • Spectral Euclidean Distance—The Euclidean distance between two multiband rasters, where each pixel is treated as a vector. Larger values indicate more change between the images.
    • Spectral Angle Difference—The spectral angle between two multiband rasters, where each pixel is treated as a vector. Larger angles indicate more change between the images.
    • Band With Most Change—The band that accounts for the most change in each pixel between two multiband rasters.

  • The output from the Categorical difference calculation type is a raster dataset with an attribute table. The table contains the transition types (for example, Forest to Urban), the number of pixels included in each transition type, and the estimated area of each transition type. Area is calculated as the pixel size multiplied by the number of pixels in each transition type. The units match the linear units of the input raster data.

  • You can limit the analysis to specific classes when computing the difference between two categorical rasters. For example, to visualize urban growth, you can include all the classes in the From Classes list, but only the Urban class in the To Classes list. The result will contain all of the transitions that contributed to the Urban category.

  • If the input rasters contain different cell sizes or extents, you can specify the cell size and extent in the Cell Size and Output Extent environment settings.

  • When the Compute Change Method parameter is set to Categorial difference, the From Raster and To Raster parameters must have an associated raster attribute table with a Value or ClassValue field. The class names for the corresponding class values are used for the output class transmission names. The tool uses the standard field class names CLASS_NAME or CLASSNAME. If these field names do not exist, you can use the Classname Field for From Raster and Classname Field for To Raster parameters to define them.

Parameters

LabelExplanationData Type
From Raster

The initial or earlier raster to be analyzed.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; String
To Raster

The final or later raster to be analyzed. This is the raster that will be compared to the initial raster.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; String
Compute Change Method
(Optional)

Specifies the type of calculation that will be performed between the two rasters.

  • DifferenceThe mathematical difference, or subtraction, between the pixel values in the rasters will be calculated. This is the default.
  • Relative differenceThe difference in pixel values, accounting for the quantities of the values being compared, will be calculated.
  • Categorical differenceThe difference between two categorical or thematic rasters will be calculated. The output will contain class transitions that occurred between the two rasters.
  • Spectral Euclidean distanceThe Euclidean distance between the pixel values of two multiband rasters will be calculated.
  • Spectral angle differenceThe spectral angle between the pixel values of two multiband rasters will be calculated. The output is in radians.
  • Band with most changeThe band that accounts for the most change in each pixel between two multiband rasters will be calculated.
String
From Classes
(Optional)

The list of class names from the From Raster parameter that will be included in the computation. If no classes are provided, all classes will be included.

This parameter is active when the Compute Change Method parameter is set to Categorical difference.

String
To Classes
(Optional)

The list of class names from the To Raster parameter that will be included in the computation. If no classes are provided, all classes will be included.

This parameter is active when the Compute Change Method parameter is set to Categorical difference.

String
Filter Method
(Optional)

Specifies the pixels that will be categorized in the output raster. This parameter is active when the Compute Change Method parameter is set to Categorical difference.

  • Changed pixels onlyOnly the pixels that changed categories will be categorized in the output. Pixels that did not change categories will be grouped in a class called Other.
  • Unchanged pixels onlyOnly the pixels that did not change categories will be categorized in the output. Pixels that changed categories will be grouped in a class called Other.
  • All pixelsAll pixels will be categorized in the output. This is the default.
String
Transition Class Colors
(Optional)

Specifies the color that will be used to symbolize the output classes. When a pixel changes from one class type to another, the output pixel color represents the initial class type, the final class type, or a blend of the two.

This parameter is active when the Compute Change Method parameter is set to Categorical difference.

  • Average From and To colorsThe color of the output class will be the average of the from (initial) and to (final) class colors. This is the default.
  • From colorThe color of the output class will match the color of the from (initial) class.
  • To colorThe color of the output class will match the color of the to (final) class.
String
Classname Field for From Raster
(Optional)

The field that will store class names in the From Raster parameter value. The tool automatically searches for the ClassName field or Class_Name field to use.

Use this parameter if the input does not contain these standard field names.

Field
Classname Field for To Raster
(Optional)

The field that will store class names in the To Raster parameter value. The tool will automatically search for the ClassName field or Class_Name field to use.

Use this parameter if the input does not contain these standard field names.

Field

Return Value

LabelExplanationData Type
Output Raster

The output change raster dataset.

Raster

ComputeChangeRaster(from_raster, to_raster, {compute_change_method}, {from_classes}, {to_classes}, {filter_method}, {define_transition_colors}, {from_classname_field}, {to_classname_field})
NameExplanationData Type
from_raster

The initial or earlier raster to be analyzed.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; String
to_raster

The final or later raster to be analyzed. This is the raster that will be compared to the initial raster.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; String
compute_change_method
(Optional)

Specifies the type of calculation that will be performed between the two rasters.

  • DIFFERENCEThe mathematical difference, or subtraction, between the pixel values in the rasters will be calculated. This is the default.
  • RELATIVE_DIFFERENCEThe difference in pixel values, accounting for the quantities of the values being compared, will be calculated.
  • CATEGORICAL_DIFFERENCEThe difference between two categorical or thematic rasters will be calculated. The output will contain class transitions that occurred between the two rasters.
  • SPECTRAL_EUCLIDEAN_DISTANCEThe Euclidean distance between the pixel values of two multiband rasters will be calculated.
  • SPECTRAL_ANGLE_DIFFERENCEThe spectral angle between the pixel values of two multiband rasters will be calculated. The output is in radians.
  • BAND_WITH_MOST_CHANGEThe band that accounts for the most change in each pixel between two multiband rasters will be calculated.
String
from_classes
[from_classes,...]
(Optional)

The list of class names from the from_raster parameter that will be included in the computation. If no classes are provided, all classes will be included.

This parameter is enabled when the compute_change_method parameter is set to CATEGORICAL_DIFFERENCE.

String
to_classes
[to_classes,...]
(Optional)

The list of class names from the to_raster parameter that will be included in the computation. If no classes are provided, all classes will be included.

This parameter is enabled when the compute_change_method parameter is set to CATEGORICAL_DIFFERENCE.

String
filter_method
(Optional)

Specifies the pixels that will be categorized in the output raster. This parameter is enabled when the compute_change_method parameter is set to CATEGORICAL_DIFFERENCE.

  • CHANGED_PIXELS_ONLYOnly the pixels that changed categories will be categorized in the output. Pixels that did not change categories will be grouped in a class called Other.
  • UNCHANGED_PIXELS_ONLYOnly the pixels that did not change categories will be categorized in the output. Pixels that changed categories will be grouped in a class called Other.
  • ALLAll pixels will be categorized in the output. This is the default.
String
define_transition_colors
(Optional)

Specifies the color that will be used to symbolize the output classes. When a pixel changes from one class type to another, the output pixel color represents the initial class type, the final class type, or a blend of the two.

This parameter is enabled when the compute_change_method parameter is set to CATEGORICAL_DIFFERENCE.

  • AVERAGEThe color of the output class will be the average of the from (initial) and to (final) class colors. This is the default.
  • FROM_COLORThe color of the output class will match the color of the from (initial) class.
  • TO_COLORThe color of the output class will match the color of the to (final) class.
String
from_classname_field
(Optional)

The field that will store class names in the from_raster parameter value. The tool automatically searches for the ClassName field or Class_Name field to use.

Use this parameter if the input does not contain these standard field names.

Field
to_classname_field
(Optional)

The field that will store class names in the to_raster parameter value. The tool will automatically search for the ClassName field or Class_Name field to use.

Use this parameter if the input does not contain these standard field names.

Field

Return Value

NameExplanationData Type
out_raster_dataset

The output change raster dataset.

Raster

Code sample

ComputeChangeRaster example 1 (Python window)

This example calculates the difference in NDVI pixel values between 2000 and 2020.

# Import system modules
import arcpy
from arcpy.ia import *

# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")

NDVIchange = arcpy.ia.ComputeChangeRaster(
	"NDVI_2000.tif", "NDVI_2020.tif", "DIFFERENCE")
	
NDVIchange.save("C:/Data/NDVI_2000_2020.tif")
ComputeChangeRaster example 2 (stand-alone script)

This example calculates the relative difference in NDVI pixel values between 2000 and 2020.

# Import system modules
import arcpy
from arcpy.ia import *

# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")

# Define input parameters
FromRaster = "C:/Data/NDVI_2000.tif"
ToRaster = "C:/Data/NDVI_2020.tif"
ChangeType = "RELATIVE_DIFFERENCE"

# Execute - calculate the relative difference in NDVI from 2000 to 2020
NDVIrelativeChange = arcpy.ia.ComputeChangeRaster(
	FromRaster, ToRaster, ChangeType)
	
# Save output
NDVIrelativeChange.save("C:/Data/Relative_NDVI_2000_2020.tif")
ComputeChangeRaster example 3 (stand-alone script)

This example computes the land cover change from 2000 to 2020, extracting only the pixels that changed from the Forest, Agriculture, Water, or Barren classes into Urban.

# Import system modules
import arcpy
from arcpy.ia import *

# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")


LandcoverChange = arcpy.ia.ComputeChangeRaster(
	"Landcover_2000.tif", "Landcover_2020.tif", "CATEGORICAL_DIFFERENCE", 
	"'Forest';'Agriculture';'Water';'Barren'", "'Urban'", 
	"CHANGED_PIXELS_ONLY", "AVERAGE")
	
# Save output  
LandcoverChange.save("C:/Data/Landcover_2000_2020.tif")

Related topics