C# merge multiple polygons into one

A GeometryCollection object is defined:

                ESRI.ArcGIS.Geometry.IGeometryCollection pGeometryCollection = new ESRI.ArcGIS.Geometry.GeometryBagClass();

After adding one or more Geometry objects, perform a merge operation:

                    ESRI.ArcGIS.Geometry.ITopologicalOperator pNewPolygon = new ESRI.ArcGIS.Geometry.PolygonClass() as ESRI.ArcGIS.Geometry.ITopologicalOperator;
                    pNewPolygon.ConstructUnion(pGeometryCollection as ESRI.ArcGIS.Geometry.IEnumGeometry);
                    ESRI.ArcGIS.Geometry.IPolygon pPolygon = pNewPolygon as ESRI.ArcGIS.Geometry.IPolygon;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325547746&siteId=291194637