Feature Compare (Data Management) |
|
Release 9.2
Last modified November 29, 2010 |
![]() ![]() ![]() Print all topics in : "Tools" |
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.
Usage tips
The tool returns messages showing the comparison result. By default the tool will stop executing after encountering the first miscompare. To report all differences, set the continue compare option to true.
Multiple sort fields may be specified. The first field is sorted, then the second field, and so on 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.
By default the compare type is set to ALL. This means all properties of the features being compared will be checked including such things as spatial reference, field properties, attributes, and geometry. However, you may choose a different compare type to check only specific properties of the features being compared.
The Ignore Options provide the flexibility to omit properties such as measure attributes, z attributes, point ID attributes, and extension properties. Two feature classes may be identical, yet one has measures and z coordinates and the other does not. You can choose to ignore these properties. Extension properties are a set of additional information added to a feature class or table. For example, the features of two annotation feature classes can be identical but the feature classes may have different extension properties such as different symbols in the symbol collection and different editing behavior.
The default XY Tolerance is determined by the default XY Tolerance of the Input Base Features. To minimize error, the value you choose for the compare tolerance should be as small as possible. If zero is entered for the XY Tolerance, an exact match is performed.
The default M Tolerance and the default Z Tolerance is determined by the default M Tolerance and Z Tolerance of the Input Base Features. The units are the same as those of the Input Base Features. If zero is entered for the M Tolerance and Z Tolerance, an exact match is performed.
When comparing FEATURES_ONLY, the spatial references must match. If the spatial references are different, a mis-compare will be reported. If the coordinate system is different for either input, the features will mis-compare. This tool does not do projection on the fly
Attribute tolerances can only be specified for numeric field types.
The Output Compare 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 which can be viewed and used as a table in ArcGIS. For example, this table can be queried to obtain all the ObjectID values for all the rows that are different. The "has_error" field indicates that that record contains an error. True indicates there is a difference.
Command line syntax
An overview of the Command Line window
FeatureCompare_management <in_base_features> <in_test_features> {sort_field;sort_field...} {ALL | GEOMETRY_ONLY | ATTRIBUTES_ONLY | SCHEMA_ONLY | SPATIAL_REFERENCE_ONLY} {IGNORE_M | IGNORE_Z | IGNORE_POINTID | IGNORE_EXTENSION_PROPERTIES} {xy_tolerance} {m_tolerance} {z_tolerance} {Field {Tolerance};Field {Tolerance}...} {omit_field;omit_field...} {NO_CONTINUE_COMPARE | CONTINUE_COMPARE} {out_compare_file}
Parameter | Explanation | Data Type |
<in_base_features> |
The Input Base Features are compared with the Input Test Features. Input Base features refers to your data that you have declared valid. This base data has the correct geometry definitions, field definitions, and spatial reference. |
Feature Layer |
<in_test_features> |
The Input Test Features are compared against the Input Base Features. Input Test Features refers to your data that you have made changes by editing or compiling new features. |
Feature Layer |
{sort_field;sort_field...} |
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. |
(String; String;...) |
{ALL | GEOMETRY_ONLY | ATTRIBUTES_ONLY | SCHEMA_ONLY | SPATIAL_REFERENCE_ONLY} |
The comparison type. ALL is the default. The default will compare all properties of the features being compared.
|
String |
{IGNORE_M | IGNORE_Z | IGNORE_POINTID | IGNORE_EXTENSION_PROPERTIES} |
These properties will not be compared during comparison.
|
String |
{xy_tolerance} |
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 zero which means the geometries must be exact. |
Linear unit |
{m_tolerance} |
The measure tolerance is the minimum distance between measures before they are considered equal. |
Double |
{z_tolerance} |
The Z Tolerance is the minimum distance between Z coordinates before they are considered equal. |
Double |
{Field {Tolerance};Field {Tolerance}...} |
The numeric value that determines the range in which attribute values are considered equal. This only applies to numeric field types. |
(Field Double; Field Double;...) |
{omit_field;omit_field...} |
The field or fields that will be omitted during comparison. The field definitions and the tabular values for these fields will be ignored. |
String |
{NO_CONTINUE_COMPARE | CONTINUE_COMPARE} |
Indicates whether to compare all properties after encountering the first mismatch.
|
Boolean |
{out_compare_file} |
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 which can be viewed and used as a table in ArcGIS. |
File |
FeatureCompare_management c:\workspace\baseroads.shp c:\workspace\newroads.shp ROAD_ID ALL IGNORE_M;IGNORE_Z '0.001 METERS' 0 0 'Shape_Length 0.001' # CONTINUE_COMPARE C:\workspace\roadcompare.txt
Scripting syntax
About getting started with writing geoprocessing scripts
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)
Parameter | Explanation | Data Type |
in_base_features (Required) |
The Input Base Features are compared with the Input Test Features. Input Base features refers to your data that you have declared valid. This base data has the correct geometry definitions, field definitions, and spatial reference. |
Feature Layer |
in_test_features (Required) |
The Input Test Features are compared against the Input Base Features. Input Test Features refers to your data that you have made changes by editing or compiling new features. |
Feature Layer |
sort_field (Optional) |
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. |
(String; String;...) |
compare_type (Optional) |
The comparison type. ALL is the default. The default will compare all properties of the features being compared.
|
String |
ignore_options (Optional) |
These properties will not be compared during comparison.
|
String |
xy_tolerance (Optional) |
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 zero which means the geometries must be exact. |
Linear unit |
m_tolerance (Optional) |
The measure tolerance is the minimum distance between measures before they are considered equal. |
Double |
z_tolerance (Optional) |
The Z Tolerance is the minimum distance between Z coordinates before they are considered equal. |
Double |
attribute_tolerances (Optional) |
The numeric value that determines the range in which attribute values are considered equal. This only applies to numeric field types. |
(Field Double; Field Double;...) |
omit_field (Optional) |
The field or fields that will be omitted during comparison. The field definitions and the tabular values for these fields will be ignored. |
String |
continue_compare (Optional) |
Indicates whether to compare all properties after encountering the first mismatch.
|
Boolean |
out_compare_file (Optional) |
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 which can be viewed and used as a table in ArcGIS. |
File |
# FeatureCompare.py # Description: Compare two feature classes and return comparison result. # Requirements: None # Author: ESRI # Date: 06/21/05 # Create the Geoprocessing Object import arcgisscripting, sys, os gp = arcgisscripting.create() try: # 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 = gp.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 gp.GetMessages() except: # Print error message if an error occurs print gp.GetMessages()