How to delete parts from geometry object?

05-11-2021 03:36 AM
Occasional Contributor II

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.

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., 'clear', 'POLYGON', spatial_reference=sr)
geoms =, arcpy.Geometry())

with arcpy.da.InsertCursor(without_holes, 'SHAPE@') as iCursor:
    for geom in geoms:
        partnum = geom.partCount
        parts = geom.getPart()
        if partnum > 1:
            lst_rm = []
            for n in range(1, partnum):
                part = geom.getPart(n)
                part_geom = arcpy.Polygon(part, sr)
                if part_geom.area > 50.0:
            for i in lst_rm:
        polygon = arcpy.Polygon(parts)
        row = (polygon,)


0 Kudos
1 Reply
MVP Honored Contributor

advanced license required

Eliminate Polygon Part (Data Management)—ArcGIS Pro | Documentation

And from @JoshuaBixby 

ArcPy: Remove Holes in Polygons (

You can examine his gist code.

... sort of retired...