<?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 How to delete parts from geometry object? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-delete-parts-from-geometry-object/m-p/1056605#M61087</link>
    <description>&lt;P&gt;I have a FeatureClass of polygons. A good part of those polygons have holes and I would like to get rid of them if they are below a certain size.&lt;/P&gt;&lt;P&gt;I managed to get to the parts and calculate their size. I also thought I delete unwanted parts... however, when writing them out there is no difference. I do not really know if my error is located in the part of deleting parts or at the point where I try to write them to disk.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.CreateFeatureclass(fc_path, 'clear', 'POLYGON', spatial_reference=sr)
geoms = arcpy.management.CopyFeatures(simplified, arcpy.Geometry())

with arcpy.da.InsertCursor(without_holes, 'SHAPE@') as iCursor:
    for geom in geoms:
        partnum = geom.partCount
        parts = geom.getPart()
        if partnum &amp;gt; 1:
            lst_rm = []
            for n in range(1, partnum):
                part = geom.getPart(n)
                part_geom = arcpy.Polygon(part, sr)
                if part_geom.area &amp;gt; 50.0:
                    lst_rm.append(n)
            lst_rm.sort(reverse=True)
            for i in lst_rm:
                parts.remove(i)
        polygon = arcpy.Polygon(parts)
        row = (polygon,)
        iCursor.insertRow(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 10:36:59 GMT</pubDate>
    <dc:creator>TomGeo</dc:creator>
    <dc:date>2021-05-11T10:36:59Z</dc:date>
    <item>
      <title>How to delete parts from geometry object?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-delete-parts-from-geometry-object/m-p/1056605#M61087</link>
      <description>&lt;P&gt;I have a FeatureClass of polygons. A good part of those polygons have holes and I would like to get rid of them if they are below a certain size.&lt;/P&gt;&lt;P&gt;I managed to get to the parts and calculate their size. I also thought I delete unwanted parts... however, when writing them out there is no difference. I do not really know if my error is located in the part of deleting parts or at the point where I try to write them to disk.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.CreateFeatureclass(fc_path, 'clear', 'POLYGON', spatial_reference=sr)
geoms = arcpy.management.CopyFeatures(simplified, arcpy.Geometry())

with arcpy.da.InsertCursor(without_holes, 'SHAPE@') as iCursor:
    for geom in geoms:
        partnum = geom.partCount
        parts = geom.getPart()
        if partnum &amp;gt; 1:
            lst_rm = []
            for n in range(1, partnum):
                part = geom.getPart(n)
                part_geom = arcpy.Polygon(part, sr)
                if part_geom.area &amp;gt; 50.0:
                    lst_rm.append(n)
            lst_rm.sort(reverse=True)
            for i in lst_rm:
                parts.remove(i)
        polygon = arcpy.Polygon(parts)
        row = (polygon,)
        iCursor.insertRow(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 10:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-delete-parts-from-geometry-object/m-p/1056605#M61087</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2021-05-11T10:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete parts from geometry object?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-delete-parts-from-geometry-object/m-p/1056607#M61088</link>
      <description>&lt;P&gt;advanced license required&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/eliminate-polygon-part.htm" target="_blank"&gt;Eliminate Polygon Part (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And from&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gist.github.com/bixb0012/5cdc276d6e590fe14f2183fd2041c50c" target="_blank"&gt;ArcPy: Remove Holes in Polygons (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can examine his gist code.&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 10:51:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-delete-parts-from-geometry-object/m-p/1056607#M61088</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-11T10:51:48Z</dc:date>
    </item>
  </channel>
</rss>

