<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Insert Cursor to insert entire layer rows in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/insert-cursor-to-insert-entire-layer-rows/m-p/1233358#M66124</link>
    <description>&lt;P&gt;Is the source layer multipart polygons and the destination is not? If so you'd have to explode first.&lt;/P&gt;&lt;P&gt;Well you'd have to use "explode" not you personally. Don't tear out your hair either way.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/multipart-to-singlepart.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/multipart-to-singlepart.htm&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;arcpy.management.MultipartToSinglepart(in_features, out_feature_class)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Or make sure the destination is also multipart.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 19:17:27 GMT</pubDate>
    <dc:creator>Brian_Wilson</dc:creator>
    <dc:date>2022-11-18T19:17:27Z</dc:date>
    <item>
      <title>Insert Cursor to insert entire layer rows</title>
      <link>https://community.esri.com/t5/python-questions/insert-cursor-to-insert-entire-layer-rows/m-p/1233316#M66119</link>
      <description>&lt;P&gt;I need to transfer an entire layers features to another layer. I am trying to use the SearchCursor and InsertCursor to do this( I know I can use append, but I am trying to this way). Both Features have the same fields and same type of geometry, both are polygons.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_features = "FeatureClass"
out_path = = "OtherFeatureClass"

dsc = arcpy.Describe(in_features)
fields = dsc.fields

# List all field names except the OID field
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]
#out_fields = [dsc.OIDFieldName]
#fieldnames = [fields.name for fields in fields if fields.name not in out_fields]
# Create cursors and insert new rows
#
with arcpy.da.SearchCursor(in_features,fieldnames) as sCur:
    with arcpy.da.InsertCursor(out_path,fieldnames) as iCur:
        for row in sCur:
            iCur.insertRow(row)
del sCur&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error.&lt;/P&gt;&lt;P&gt;iCur.insertRow(row)&lt;BR /&gt;RuntimeError: Number of parts in shape is incorrect for its geometry type&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 17:55:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-cursor-to-insert-entire-layer-rows/m-p/1233316#M66119</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2022-11-18T17:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Cursor to insert entire layer rows</title>
      <link>https://community.esri.com/t5/python-questions/insert-cursor-to-insert-entire-layer-rows/m-p/1233358#M66124</link>
      <description>&lt;P&gt;Is the source layer multipart polygons and the destination is not? If so you'd have to explode first.&lt;/P&gt;&lt;P&gt;Well you'd have to use "explode" not you personally. Don't tear out your hair either way.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/multipart-to-singlepart.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/multipart-to-singlepart.htm&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;arcpy.management.MultipartToSinglepart(in_features, out_feature_class)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Or make sure the destination is also multipart.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 19:17:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-cursor-to-insert-entire-layer-rows/m-p/1233358#M66124</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2022-11-18T19:17:27Z</dc:date>
    </item>
  </channel>
</rss>

