Skip to main content
2 of 2
deleted 42 characters in body; edited tags; edited title; edited title
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Creating holes from overlapping polygons in ArcObjects and C#?

I have a polygon layer which contains some overlapping polygons.

enter image description here

I want Holes instead of overlapping polygons.

i tried some code

                  ESRI.ArcGIS.ArcMapUI.IMxDocument mxd = ArcMap.Application.Document 
         as ESRI.ArcGIS.ArcMapUI.IMxDocument;
            if (mxd.SelectedItem is ESRI.ArcGIS.Carto.IFeatureLayer)
            {
                ESRI.ArcGIS.Carto.IFeatureLayer flay = mxd.SelectedItem as ESRI.ArcGIS.Carto.IFeatureLayer;
                ESRI.ArcGIS.Geodatabase.IFeatureClass fcls = flay.FeatureClass;
                ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();

                spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelOverlaps;
                ESRI.ArcGIS.Geodatabase.IFeatureCursor fcur = flay.Search(spatialFilter, true);
                ESRI.ArcGIS.Geodatabase.IFeature fea = fcur.NextFeature();
                while (fea!=null)
                {
                    ESRI.ArcGIS.Geometry.IGeometry geo= fea.Shape;
                    ESRI.ArcGIS.Geometry.IGeometryCollection gcoll = geo as ESRI.ArcGIS.Geometry.IGeometryCollection;
                   
                    fea = fcur.NextFeature();
                }

How can I do this?