ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Raster Compare

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Analyze the properties of two raster or mosaic datasets.

Usage

  • The tool returns messages showing the comparison result.

  • The parameter and attribute tolerances allow your comparisons to have a specified amount of leeway.

  • For Python syntax, you will need to open the tool dialog to view a list of values for the Ignore Options parameter. Your Compare Type will determine which Ignore Options are valid.

Syntax

RasterCompare_management (in_base_raster, in_test_raster, {compare_type}, {ignore_option}, {continue_compare}, {out_compare_file}, {parameter_tolerances}, {attribute_tolerances}, {omit_field})
ParameterExplanationData Type
in_base_raster

The first raster or mosaic dataset to compare.

Raster Layer; Mosaic Layer
in_test_raster

The second raster or mosaic dataset to compare with the first.

Raster Layer; Mosaic Layer
compare_type
(Optional)

The type of raster to be compared.

  • RASTER_DATASET —Compare two raster datasets.
  • GDB_RASTER_DATASET —Compare two raster datasets in a geodatabase.
  • GDB_RASTER_CATALOG —Compare two raster catalogs in a geodatabase.
  • MOSAIC_DATASET —Compare two mosaic datasets.
String
ignore_option
[ignore_option,...]
(Optional)

The properties that you do not want to include in the comparison.

To determine the full list of properties, open the tool dialog and view the list of values for the Ignore Options parameter. Your Compare Type will determine which Ignore Options are valid.

String
continue_compare
(Optional)

When a mismatch is encountered, stop the comparison.

  • NO_CONTINUE_COMPARE —Stop comparing upon the discovery of a mismatch.
  • CONTINUE_COMPARE —Continue comparing the raster datasets if a mismatch is found.
Boolean
out_compare_file
(Optional)

Create a text file containing the comparison results.

File
parameter_tolerances
[[Parameter, Tolerance, Type],...]
(Optional)

Incorporate some leeway into the accuracy when comparing parameters. You can have different tolerances for each parameter, if necessary. Set the tolerance type to either be the value that you enter, or use that value as a fraction. For example, if your base value is 100 and you set the fraction tolerance to 0.00001, the compare tolerance will be 100 * 0.00001 = 0.001

There are seven types of parameter tolerances that you can adjust.

  • All —Compare the extents, pixel values, minimums, maximums, means, and standard deviations to see if they are equal within the specified tolerance.
  • Extent —If the difference of the extents is within the tolerance, consider them equal.
  • Pixel_Value —If the difference of the pixel values is within the tolerance, consider them equal.
  • Statistics_Minimum —If the difference of the minimums is within the tolerance, consider them equal.
  • Statistics_Maximum —If the difference of the maximums is within the tolerance, consider them equal.
  • Statistics_Mean —If the difference of the means is within the tolerance, consider them equal.
  • Statistics_Standard_Deviation —If the difference of the standard deviations is within the tolerance, consider them equal.
Value Table
attribute_tolerances
[[Field, Tolerance],...]
(Optional)

The fields that you want to compare to see if they are within a tolerance. The tolerance value is a value in the units of the attribute.

Value Table
omit_field
[omit_field,...]
(Optional)

The list of fields to not compare.

String

Code sample

RasterCompare example 1 (Python window)

This is a Python sample for RasterCompare.

import arcpy
RasterCompare_management("C:/workspace/image1.tif","C:/workspace/image2.tif",\
                         "RASTER_DATASET","'Pyramids Exist'",\
                         "CONTINUE_COMPARE","C:/workspace/compare01.txt",\
                         "Pixel_Value 1 Value","Count 5","OID")
RasterCompare example 2 (stand-alone script)

This is a Python sample for RasterCompare.

##====================================
##Raster Compare
##Usage: RasterCompare_management in_base_raster in_test_raster {RASTER_DATASET |
##                                GDB_RASTER_DATASET | GDB_RASTER_CATALOG |
##                                MOSAIC_DATASET} {ignore_option;ignore_option...}
##                                {NO_CONTINUE_COMPARE | CONTINUE_COMPARE} 
##                                {out_compare_file} {Parameter {Tolerance} {Type};
##                                Parameter {Tolerance} {Type}...} {Field {Tolerance};
##                                Field {Tolerance}...} {omit_field;omit_field...} 
    
    
try:
    import arcpy
    
    arcpy.env.workspace = "c:/workspace"
    
    ##Compare two Raster dataset
    arcpy.RasterCompare_management("raster_base.tif","raster_test.tif","RASTER_DATASET",\
                                   "","CONTINUE_COMPARE","compareresult.txt","","","")
    
    ##Compare two Raster Catalog with ignore options
    arcpy.RasterCompare_management("fgdb.gdb/rc_base","fgdb.gdb/rc_test","RASTER_CATALOG",\
                                   "IsManaged;Extent","CONTINUE_COMPARE","compareresult2.txt",\
                                   "","","DATE")
    
    ##Compare two Mosaic Dataset with torelance
    arcpy.RasterCompare_management("fgdb.gdb/md_base","fgdb.gdb/md_test","MOSAIC_DATASET",\
                                   "IsEmbedded;Seamline","CONTINUE_COMPARE","compareresult3.txt",\
                                   "All 0.00001 Fraction","HighPS 0.0001;LowPS 0.0001",\
                                   "ItemTS;UriHash")
    
except:
    print "Raster Compare exsample failed."
    print arcpy.GetMessages()

Environments

  • Current Workspace
  • Scratch Workspace

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics

  • An overview of the Data Comparison toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal