I'm using ArcPy to compare two feature classes from Esri file geodatabases using the Feature Compare (Data Management) tool. The script itself works very well. However it always uses the OBJECTID to perform the comparison.
I am using ArcGIS 10.3.1
import arcpy try: # Set local variables test_features = r'myTestFeatureClass' base_features = r'myBaseFeatureClass' sort_field = "MyCustomID" 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 = r'C:\data\comparefile.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() except: # Print error message if an error occurs print arcpy.GetMessages()
Does anyone know if there is a way to use a custom ID field for the comparison? In my script I am using "MyCustomID" as a sort parameter. But the result still lists comparisons based on the OBJECTID.