ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / MultipartToSinglePart Method
The geometry to make into single component geometries

In This Topic
    MultipartToSinglePart Method (GeometryEngine)
    In This Topic
    Separates the components of a geometry into single component geometries.
    public IReadOnlyList<Geometry> MultipartToSinglePart( 
       Geometry geometry
    Public Function MultipartToSinglePart( _
       ByVal geometry As Geometry _
    ) As IReadOnlyList(Of Geometry)


    The geometry to make into single component geometries

    Return Value

    Read-only list of geometries
    Geometry is null.
    Not implemented for Multipatch.
    Spatial reference of geometryis an image coordinate system.
    A single part geometry will not be affected (i.e. it will just get passed along) with the exception of a multipoint which will become points. The number of output geometries may not equal the number of parts in the input geometry. For example, if a polygon has a hole, then the outer ring and inner ring are returned as one geometry.

    If the input geometry is empty, then the returned list will contain one entry which is the input geometry.

    Separate components of a geometry into single component geometries
    List<Coordinate2D> coords2D = new List<Coordinate2D>()
        new Coordinate2D(0, 0),
        new Coordinate2D(1, 4),
        new Coordinate2D(2, 7),
        new Coordinate2D(-10, 3)
    Multipoint multipoint = MultipointBuilderEx.CreateMultipoint(coords2D, SpatialReferences.WGS84);
    IReadOnlyList<Geometry> result = GeometryEngine.Instance.MultipartToSinglePart(multipoint);
    // result.Count = 4, 
    // 'explode' a multipart polygon
    result = GeometryEngine.Instance.MultipartToSinglePart(multipartPolygon);
    // create a bag of geometries
    Polygon polygon = PolygonBuilderEx.CreatePolygon(coords2D, SpatialReferences.WGS84);
    //At 2.x - GeometryBag bag = GeometryBagBuilder.CreateGeometryBag(new List<Geometry>() { multipoint, polygon });
    var bag = GeometryBagBuilderEx.CreateGeometryBag(new List<Geometry>() { multipoint, polygon });
    // bag.PartCount = =2
    result = GeometryEngine.Instance.MultipartToSinglePart(bag);
    // result.Count == 2
    // result[0] is MultiPoint
    // result[1] is Polygon

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also