苏小测

导航

 
https://gis.stackexchange.com/questions/90372/using-arcpy-da-insertcursor-to-insert-entire-row-that-is-fetched-from-search-cur

# Get field objects from source FC # dsc = arcpy.Describe(sourceFC) fields = dsc.fields # List all field names except the OID field and geometry fields # Replace 'Shape' with 'SHAPE@' # out_fields = [dsc.OIDFieldName, dsc.lengthFieldName, dsc.areaFieldName] fieldnames = [field.name if field.name != 'Shape' else 'SHAPE@' for field in fields if field.name not in out_fields] # Create cursors and insert new rows # with arcpy.da.SearchCursor(sourceFC,fieldnames) as sCur: with arcpy.da.InsertCursor(targetFC,fieldnames) as iCur: for row in sCur: iCur.insertRow(row)
posted on 2021-03-09 08:34  苏小测  阅读(135)  评论(0编辑  收藏  举报