ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

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
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Raster Compare

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

Summary

Compares the properties of two raster datasets, two raster catalogs, or two mosaic dataset and then returns the comparison result.

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 input raster that will be compared to the test raster.

Valid inputs include a raster dataset, a raster catalog or a mosaic dataset.

Raster Layer; Raster Catalog Layer; Mosaic Layer
in_test_raster

The test raster that will be compared to the input base raster.

Valid inputs include a raster dataset, a raster catalog or a mosaic dataset.

Raster Layer; Raster Catalog Layer; Mosaic Layer
compare_type
(Optional)

The type of comparison.

  • RASTER_DATASET —Compares raster dataset properties.
  • GDB_RASTER_DATASET —Compares properties of raster datasets in a geodatabase.
  • GDB_RASTER_CATALOG —Compares properties of raster catalogs in a geodatabase.
  • MOSAIC_DATASET —Compares properties of mosaic datasets.
String
ignore_option
[ignore_option,...]
(Optional)

The properties specified will not be compared during comparison.

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.

String
continue_compare
(Optional)

Indicates whether to compare all properties after encountering the first mismatch.

  • NO_CONTINUE_COMPARE —Stop after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARE —Compare other properties after encountering the first mismatch.
Boolean
out_compare_file
(Optional)

The name and path of the text file which will contain the comparison results.

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

The Parameter Tolerance allows you to compare your parameter values with some leeway on accuracy. This allows you to account for any slight changes that might have occurred in processing your data.

For a list of Parameter types, choose the parameters for which you would like to have a tolerance. For each parameter you will need a tolerance and tolerance type. The tolerance type is either the value of the tolerance or a fraction of it. When using the fraction type, the fraction is based on the base value; therefore, the tolerance value for comparison would be the fraction times the base value. 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

  • All —This option will apply the same tolerance to the extent, pixel value, minimum pixel value, maximum pixel value, mean pixel value, and standard deviation pixel value.
  • Extent —The extent of the raster will have an allowable tolerance.
  • Pixel_Value —The pixel values of the raster will have an allowable tolerance.
  • Statistics_Minimum —The minimum pixel value of the raster will have an allowable tolerance.
  • Statistics_Maximum —The maximum pixel value of the raster will have an allowable tolerance.
  • Statistics_Mean —The mean pixel value of the raster will have an allowable tolerance.
  • Statistics_Standard_Deviation —The standard deviation pixel value of the raster will have an allowable tolerance.
Value Table
attribute_tolerances
[[Field, Tolerance],...]
(Optional)

The Attribute Tolerance allows you to compare your attribute values with some leeway on accuracy. This allows you to account for any slight changes that might have occurred in processing your data.

Type the field name and tolerance value for each parameter for which you want to have a tolerance. The tolerance value is the actual value of the tolerance, not a fraction.

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

These are the fields you would like to Omit in the comparison results. Type in the fields to omit in the comparison.

When dealing with a raster catalog scenario, you are comparing attribute columns of the raster catalogs, not any attributes within the catalog items.

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 for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Data Comparison toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • 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