ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / SlicePolygonIntoEqualParts Method
The polygon to slice.
The number of equal area parts to slice the polygon into. Must be greater than 1.
Angle (in radians) to rotate the polygon before it is sliced. The angle is measured from the positive X-axis in a counterclockwise direction.
Controls how the polygon is sliced; into strips or blocks.
Example

In This Topic
    SlicePolygonIntoEqualParts Method (GeometryEngine)
    In This Topic
    Slices a polygon into a set of equal area parts.
    Syntax
    Public Function SlicePolygonIntoEqualParts( _
       ByVal polygon As Polygon, _
       ByVal numParts As Integer, _
       ByVal angle As Double, _
       ByVal sliceType As SliceType _
    ) As IReadOnlyList(Of Polygon)

    Parameters

    polygon
    The polygon to slice.
    numParts
    The number of equal area parts to slice the polygon into. Must be greater than 1.
    angle
    Angle (in radians) to rotate the polygon before it is sliced. The angle is measured from the positive X-axis in a counterclockwise direction.
    sliceType
    Controls how the polygon is sliced; into strips or blocks.

    Return Value

    Returns the polygons. If none are created, then the collection returned is empty.
    Exceptions
    ExceptionDescription
    The polygon is null.
    The polygon must be sliced into at least 2 parts.
    Remarks
    Slicing into strips produces parallel equal area parts. The slicing starts from the bottom of the polygon and proceeds to the top.

    The following image illustrates a polygon divided into strips. Each polygon is sliced with a different angle; starting at 0 and increasing by 30 degrees.

    PolygonSliceStrips

    Slicing into blocks produces equal area parts, not necessarily strips. The slicing is done recursively, each time slicing the polygon into two parts along the larger dimension (height or width).

    The following image illustrates a polygon divided into blocks. Each polygon is sliced with a different angle; starting at 0 and increasing by 30 degrees.

    PolygonSliceBlocks

    Example
    Slice a Polygon into equal parts
          
    var slices = GeometryEngine.Instance.SlicePolygonIntoEqualParts(polygon, 3, 0, SliceType.Blocks);
    // slices.Count = 3
    
    
    // simple polygon
    List<Coordinate2D> list2D = new List<Coordinate2D>();
    list2D.Add(new Coordinate2D(1.0, 1.0));
    list2D.Add(new Coordinate2D(1.0, 2.0));
    list2D.Add(new Coordinate2D(2.0, 2.0));
    list2D.Add(new Coordinate2D(2.0, 1.0));
    
    Polygon p = PolygonBuilderEx.CreatePolygon(list2D);
    slices = GeometryEngine.Instance.SlicePolygonIntoEqualParts(p, 2, 0, SliceType.Strips);
    
    // slice[0] coordinates - (1.0, 1.0), (1.0, 1.5), (2.0, 1.5), (2.0, 1.0), (1.0, 1.0) 
    // slice[1] coordinates - (1.0, 1.5), (1.0, 2.0), (2.0, 2.0), (2.0, 1.5), (1.0, 1.5)
    
    slices = GeometryEngine.Instance.SlicePolygonIntoEqualParts(p, 2, Math.PI / 4, SliceType.Strips);
    
    // slice[0] coordinates - (1.0, 1.0), (1.0, 2.0), (2.0, 1.0), (1.0, 1.0)
    // slice[1] coordinates - (1.0, 2.0), (2.0, 2.0), (2.0, 1.0), (1.0, 2.0)
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also