I'm trying to use ArcPy to copy only the geometry from one feature class to another based on a certain condition. Here is my code so far:
source_fields = ['contition_field', 'SHAPE@']
icursor = arcpy.da.InsertCursor(target_fc, 'SHAPE@')
with arcpy.da.SearchCursor(source_fc, source_fields) as scursor:
for row in scursor:
if row[0] == 'condition1':
icursor.insertRow(row[1])
When I try to run it, I get this:
TypeError Traceback (most recent call last)
<ipython-input-14-bc6790d82eb2> in <module>
6 for row in scursor:
7 if row[0] == 'condition1':
----> 8 icursor.insertRow(row[1])
9
10
TypeError: cannot read geometry sequence. expected list of floats
I tried doing a few searches on this error, but it seems like most people don't have a problem with copying geometry, they have problem with copying other fields. However nothing seems to allow me to copy the feature geometry (like in this thread):
Insert Geometry and update attribute using arcpy.da.InsertCursor
What is wrong?
insertRow()
expects a sequence of values but you're passing in a single geometry object, try passing in a single-item list:icursor.insertRow([row[1]])