Compute Change Raster (Image Analyst)

Disponible con licencia de Image Analyst.

Resumen

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

Uso

  • 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 and the pixel values in the To Raster.

      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.

  • The output from the Categorical difference computation 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 your 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.

Sintaxis

ComputeChangeRaster(from_raster, to_raster, {compute_change_method}, {from_classes}, {to_classes}, {filter_method}, {define_transition_colors})
ParámetroExplicaciónTipo de datos
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
(Opcional)

Specifies the type of calculation to perform 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 in which the output contains class transitions that occurred between the two rasters.
String
from_classes
[from_classes,...]
(Opcional)

The list of class names from the from_raster parameter to 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,...]
(Opcional)

The list of class names from the to_raster parameter to 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
(Opcional)

Specifies the pixels to 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. All 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. All pixels that changed categories will be groups in a class called Other.
  • ALLAll pixels will be categorized in the output. This is the default.
String
define_transition_colors
(Opcional)

Specifies the color to use 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

Valor de retorno

NombreExplicaciónTipo de datos
out_raster_dataset

The output change raster dataset.

Raster

Muestra de código

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")

Información de licenciamiento

  • Basic: Requiere Image Analyst
  • Standard: Requiere Image Analyst
  • Advanced: Requiere Image Analyst

Temas relacionados