Select to view content in your preferred language

Full compare

395
2
03-14-2024 05:34 PM
Moi_Nccncc
New Contributor III

I have 2 identical feature class with unique ID, I want to get All IDS from both classes which 
NEW exists in feature  Class 1 not exists in feature Class 2

DELETED exists in feature  Class 2 not exists in feature Class 1

 

Any ready code?

Tags (1)
2 Replies
AlfredBaldenweck
MVP Regular Contributor

Try the feature compare tool?

Just make sure that it doesn’t stop at the first difference and then look at the output table.

https://pro.arcgis.com/en/pro-app/3.1/tool-reference/data-management/feature-compare.htm

 

Assuming that they have a common identifying field like an ID or name, you could also try joining the two tables on that field and then select by attribute or definition query to meet your criteria.

0 Kudos
Tom_Laue
New Contributor III

To get unique values in a field, I've used.

 

import arcpy

featureClass = r"C:\Default.gdb\Export_Output_10"
fields = ['FEATUREID']

listOfValues=[]

with arcpy.da.SearchCursor(featureClass, fields) as cursor:
    for row in cursor:
        listOfValues.append(row[0])

 

Then you can convert the list to a set.

 

# set() to convert list to set
set_of_values  = set(listOfValues)

 

 

Sets can be subtracted from each other to find the differences.

Python Set | difference() - GeeksforGeeks

0 Kudos