Below is an example on how I was able to accomplish this. The OBJECTIDs for the two feature classes were the same, so I first appended all the new features created for a polygon split. Then I compare the original geometry to each geometry in the subset feature class (excluding new features). If the geometry is different, I delete the original feature and update with the new feature (the other half of the geometry that was created from the polygon split). Since I used the OBJECTID I can only run this script once as the OBJECTIDs in the original feature class will change after the appends.import arcpy from arcpy import env env.workspace = r"C:\temp\python\test.gdb" env.overwriteOutput = True fcA = "AirportsA" fcB = "AirportsB" OID_list = [] listB = [] # find max OBJECTID rows = arcpy.SearchCursor(fcA) for row in rows: OID_list.append(row.OBJECTID) del row, rows maxOID = sorted(OID_list)[-1] # append all geometries for AirportsB to list rows = arcpy.SearchCursor(fcB) for row in rows: geom = row.Shape listB.append(geom.area) del row, rows # append all new features to AirportsA feature class arcpy.MakeFeatureLayer_management(fcB, "AirportsB_lyr", "OBJECTID > " + str(maxOID)) arcpy.CopyFeatures_management("AirportsB_lyr", "AirportsB_2") arcpy.Append_management("AirportsB_2", fcA, "NO_TEST") x = 0 # compare geometries from AirportsA to AirportsB rows = arcpy.SearchCursor(fcA, "OBJECTID <= " + str(maxOID)) for row in rows: geom = row.Shape if geom.area != listB: print "OBJECTID " + str(row.OBJECTID) + " has changed" arcpy.MakeFeatureLayer_management(fcA, "AirportsA_lyr") arcpy.SelectLayerByAttribute_management("AirportsA_lyr", "NEW_SELECTION", "OBJECTID = " + str(row.OBJECTID)) # delete original features that changed arcpy.DeleteFeatures_management("AirportsA_lyr") arcpy.MakeFeatureLayer_management(fcB, "AirportsB_lyr", "OBJECTID = " + str(row.OBJECTID)) # append new split feature arcpy.Append_management("AirportsB_lyr", fcA, "NO_TEST") x += 1 del row, rows
import arcpy from arcpy import env env.workspace = r"C:\temp\python\test.gdb" env.overwriteOutput = True fcA = "AirportsA" fcB = "AirportsB" OID_list = [] listB = [] # find max OBJECTID rows = arcpy.SearchCursor(fcA) for row in rows: OID_list.append(row.OBJECTID) del row, rows maxOID = sorted(OID_list)[-1] # append all geometries for AirportsB to list rows = arcpy.SearchCursor(fcB) for row in rows: geom = row.Shape listB.append(geom.area) del row, rows # append all new features to AirportsA feature class arcpy.MakeFeatureLayer_management(fcB, "AirportsB_lyr", "OBJECTID > " + str(maxOID)) arcpy.CopyFeatures_management("AirportsB_lyr", "AirportsB_2") arcpy.Append_management("AirportsB_2", fcA, "NO_TEST") x = 0 # compare geometries from AirportsA to AirportsB rows = arcpy.SearchCursor(fcA, "OBJECTID <= " + str(maxOID)) for row in rows: geom = row.Shape if geom.area != listB: print "OBJECTID " + str(row.OBJECTID) + " has changed" arcpy.MakeFeatureLayer_management(fcA, "AirportsA_lyr") arcpy.SelectLayerByAttribute_management("AirportsA_lyr", "NEW_SELECTION", "OBJECTID = " + str(row.OBJECTID)) # delete original features that changed arcpy.DeleteFeatures_management("AirportsA_lyr") arcpy.MakeFeatureLayer_management(fcB, "AirportsB_lyr", "OBJECTID = " + str(row.OBJECTID)) # append new split feature arcpy.Append_management("AirportsB_lyr", fcA, "NO_TEST") x += 1 del row, rows
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.