polygonSlicerOperator

AMD: require(["esri/geometry/operators/polygonSlicerOperator"], (polygonSlicerOperator) => { /* code goes here */ });
ESM: import * as polygonSlicerOperator from "@arcgis/core/geometry/operators/polygonSlicerOperator.js";
Object: esri/geometry/operators/polygonSlicerOperator
Since: ArcGIS Maps SDK for JavaScript 4.31
beta

Performs a topological operation for slicing a 2D polygon into smaller polygons.

Method Overview

Name Return Type Summary Object

Finds positions of the sliced strips for a given polygon given the number of equal area parts to slice the polygon into.

polygonSlicerOperator

Slices the given polygon into equal area parts, not necessarily strips.

polygonSlicerOperator

Slices the given polygon into strips.

polygonSlicerOperator

Method Details

findSlicesByArea

Method
findSlicesByArea(polygon, partCount, remainingArea, options){Number[]}

Finds positions of the sliced strips for a given polygon given the number of equal area parts to slice the polygon into.

Parameters
Specification
polygon Polygon

The input polygon.

partCount Number

The number of parts to slice into.

remainingArea Number

The size of the remaining piece of the uncut polygon. Pass zero, if you want to slice the whole polygon. Unless the unit option is set, the default is the spatial reference unit of polygon.

options Object
optional

Additional options.

Specification
transform Transformation
optional

The affine transformation to apply to the polygon before slicing. When applying the transformation, the slicing starts from the bottom and proceeds to the top. The default is the identity transformation. For horizontal slices, use Transformation.setIdentity(). To slice vertically, apply Transformation.setSwapCoordinates() that swaps x and y coordinate values, and for an arbitrary angle, use Transformation.rotate().

unit AreaUnit
optional

The area unit of the remaining area.

Returns
Type Description
Number[] Returns the y-coordinate set for the slice positions sorted in increasing y-order. The set can be used as input to the sliceIntoStrips() method.
Example
// Find the slice positions for a polygon
const slicePositions = polygonSlicerOperator.findSlicesByArea(polygon, 3, 0);

recursiveSliceEqualArea

Method
recursiveSliceEqualArea(polygon, partCount, options){Polygon[]}

Slices the given polygon into 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).

Parameters
polygon Polygon

The input polygon to slice.

partCount Number

The number of equal area parts to slice the polygon into.

options Object
optional

Additional options.

Specification
transform Transformation
optional

The affine transformation to apply to the polygon before slicing.

Returns
Type Description
Polygon[] Returns the array of polygons that are the result of the slicing. The number of output polygons will not necessarily match the number of requested slices. For example, if some of the slices became degenerate, they may not be output. The method uses topological operations that rely on the tolerance value in the input spatial reference. These operations may shift vertices in a way that affects result areas.
Example
// Slice a polygon into equal area parts
const slicedPolygons = polygonSlicerOperator.recursiveSliceEqualArea(polygon, 3);

sliceIntoStrips

Method
sliceIntoStrips(polygon, ySlices, options){Polygon[]}

Slices the given polygon into strips.

Parameters
polygon Polygon

The input polygon to slice.

ySlices Number[]

The array of y coordinates, sorted in ascending order. The polygon will be transformed with the transform, and then it will be sliced horizontally at each y coordinate. That is, the ySlices are given in the coordinates after transform is applied to the polygon.

options Object
optional

Additional options.

Specification
transform Transformation
optional

The affine transformation to apply to the polygon before slicing.

Returns
Type Description
Polygon[] Returns the array of polygons that are the result of the slicing. The number of output polygons will not necessarily match the number of requested slices. For example, if some of the slices became degenerate, they may not be output. The method uses topological operations that rely on the tolerance value in the input spatial reference. These operations may shift vertices in a way that affects result areas.
Example
// Slice a polygon into strips
const slicedPolygons = polygonSlicerOperator.sliceIntoStrips(polygon, [100, 200, 300]);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.