require(["esri/geometry/operators/polygonSlicerOperator"], (polygonSlicerOperator) => { /* code goes here */ });
import * as polygonSlicerOperator from "@arcgis/core/geometry/operators/polygonSlicerOperator.js";
esri/geometry/operators/polygonSlicerOperator
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
-
Finds positions of the sliced strips for a given polygon given the number of equal area parts to slice the polygon into.
ParametersSpecificationpolygon PolygonThe input polygon.
partCount NumberThe number of parts to slice into.
remainingArea NumberThe 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 ofpolygon
.options ObjectoptionalAdditional options.
Specificationtransform TransformationoptionalThe 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 AreaUnitoptionalThe area unit of the remaining area.
ReturnsType 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);
-
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).
Parameterspolygon PolygonThe input polygon to slice.
partCount NumberThe number of equal area parts to slice the polygon into.
options ObjectoptionalAdditional options.
Specificationtransform TransformationoptionalThe affine transformation to apply to the polygon before slicing.
ReturnsType 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);
-
Slices the given polygon into strips.
Parameterspolygon PolygonThe input polygon to slice.
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 ObjectoptionalAdditional options.
Specificationtransform TransformationoptionalThe affine transformation to apply to the polygon before slicing.
ReturnsType 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]);