Hi,
I'm trying to insert/create geometries using "feature A" geometries into feature B, which has null geometries . It seems simple enough but I'm not well acquainted with programming. This is what I have:
import arcpy
#Setup environment and variables
arcpy.env.workspace = r'C:\\Users\\xyz\\OneDrive - xyz, BUREAU OF TECH. SERVICES\\Documents\\ArcGIS\\Projects\\Migration\\ Migration.gdb'
A = 'Easement_for_Treat'
idfieldA = 'IDFieldA'
B = "Work_Area_Migration_Merge"
idfieldB = 'IDFieldB'
#Build a dictionary with IDs as keys and geometries as value
geometries = {key:value for (key,value) in arcpy.da.SearchCursor(A, [idfieldA, 'SHAPE@'])}
#Empty list to store ids in B not found in A
notfound = []
#Insert B with geometries from A where ID:s match
with arcpy.da.InsertCursor(B, [idfieldB, 'SHAPE@']) as cursor:
for row in cursor:
try:
row[1] = geometries[row[0]]
insert.updateRow(row)
except:
notfound.append(row[0])
I get thrown this exception:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
In [2]:
Line 18: for row in cursor:
TypeError: 'da.InsertCursor' object is not iterable
---------------------------------------------------------------------------
Any guidance would be greatly appreciated!