Feature Compare (Data Management)


Compares two feature classes or layers and returns the comparison results. Feature Compare can report differences with geometry, tabular values, spatial reference, and field definitions.



FeatureCompare_management (in_base_features, in_test_features, sort_field, {compare_type}, {ignore_options}, {xy_tolerance}, {m_tolerance}, {z_tolerance}, {attribute_tolerances}, {omit_field}, {continue_compare}, {out_compare_file})
ParameterExplanationData Type

The Input Base Features are compared with the Input Test Features. Input Base features refers to data that you have declared valid. This base data has the correct geometry definitions, field definitions, and spatial reference.

Feature Layer

The Input Test Features are compared against the Input Base Features. Input Test Features refers to data that you have made changes to by editing or compiling new features.

Feature Layer

The field or fields used to sort records in the Input Base Table and the Input Test Table. The records are sorted in ascending order. Sorting by a common field in both the Input Base Features and the Input Test Features ensures that you are comparing the same row from each input dataset.

Value Table

The comparision type. ALL is the default. The default will compare all properties of the features being compared.

  • ALLAll properties of the feature classes will be compared. This is the default.
  • GEOMETRY_ONLYOnly the geometries of the feature classes will be compared.
  • ATTRIBUTES_ONLYOnly the attributes and their values will be compared.
  • SCHEMA_ONLYOnly the schema of the feature classes will be compared.
  • SPATIAL_REFERENCE_ONLYOnly the spatial references of the two feature classes will be compared.

These properties will not be compared during comparison.

  • IGNORE_MDo not compare measure properties.
  • IGNORE_ZDo not compare elevation properties.
  • IGNORE_POINTIDDo not compare point id properties.
  • IGNORE_EXTENSION_PROPERTIESDo not compare extension properties.
  • IGNORE_SUBTYPESDo not compare subtypes.
  • IGNORE_RELATIONSHIPCLASSESDo not compare relationship classes.
  • IGNORE_REPRESENTATIONCLASSESDo not compare representation classes.

The distance that determines the range in which features are considered equal. To minimize error, the value you choose for the compare tolerance should be as small as possible. By default, the compare tolerance is the XY Tolerance of the input base features.

Linear unit

The measure tolerance is the minimum distance between measures before they are considered equal.


The Z Tolerance is the minimum distance between Z coordinates before they are considered equal.

[[Field, {Tolerance}],...]

The numeric value that determines the range in which attribute values are considered equal. This only applies to numeric field types.

Value Table

The field or fields that will be omitted during comparison. The field definitions and the tabular values for these fields will be ignored.


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

  • NO_CONTINUE_COMPAREStops after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARECompares other properties after encountering the first mismatch.

This file will contain all similarities and differences between the Input Base Features and the Input Test Features. This file is a comma-delimited text file that can be viewed and used as a table in ArcGIS.


Code Sample

FeatureCompare tool example (Python window)

The following Python window script demonstrates how to use the FeatureCompare function in immediate mode.

import arcpy
arcpy.FeatureCompare_management(r'C:/Workspace/baseroads.shp', r'C:/Workspace/newroads.shp', 'ROAD_ID', 'ALL', 'IGNORE_M;IGNORE_Z', '0.001 METERS', 0, 0, 'Shape_Length 0.001', '#', 'CONTINUE_COMPARE', e = r'C:/Workspace/roadcompare.txt')
FeatureCompare tool example (stand-alone script)

Example of how to use the FeatureCompare tool in a stand-alone script.

# Name: FeatureCompare.py
# Description: Compare two feature classes and return comparison result.

# import system modules 
import arcpy

    # Set local variables
    base_features = "C:/Workspace/baseroads.shp"
    test_features = "C:/Workspace/newroads.shp"
    sort_field = "ROAD_ID"
    compare_type = "ALL"
    ignore_option = "IGNORE_M;IGNORE_Z"
    xy_tolerance = "0.001 METERS"
    m_tolerance = 0
    z_tolerance = 0
    attribute_tolerance = "Shape_Length 0.001"
    omit_field = "#"
    continue_compare = "CONTINUE_COMPARE"
    compare_file = "C:/Workspace/roadcompare.txt"
    # Process: FeatureCompare
    compare_result = arcpy.FeatureCompare_management(base_features, test_features, sort_field, compare_type, ignore_option, xy_tolerance, m_tolerance, z_tolerance, attribute_tolerance, omit_field, continue_compare, compare_file)
    print compare_result
    print arcpy.GetMessages()
    # Print error message if an error occurs
    print arcpy.GetMessages()


This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes