require(["esri/geometry/operators/differenceOperator"], (differenceOperator) => { /* code goes here */ });
import * as differenceOperator from "@arcgis/core/geometry/operators/differenceOperator.js";
esri/geometry/operators/differenceOperator
Performs a topological difference operation on 2D geometries.
Property Overview
Name | Type | Summary | Object |
---|---|---|---|
Indicates if the operator supports input geometries that contain curves. | differenceOperator |
Property Details
-
supportsCurves
supportsCurves Booleanreadonly
-
Indicates if the operator supports input geometries that contain curves.
- Default Value:true
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Performs the topological difference operation on the two geometries. | differenceOperator | ||
Performs the Topological difference operation on the geometry set. | differenceOperator |
Method Details
-
execute
execute(geometry, subtractor){GeometryUnion |null |undefined}
-
Performs the topological difference operation on the two geometries.
Parametersgeometry GeometryUnionThe geometry instance on the left hand side of the subtraction.
subtractor GeometryUnionThe geometry on the right hand side being subtracted.
ReturnsType Description GeometryUnion | null | undefined Returns the result of the subtraction from the geometry
, or null. The result has the dimensions of thegeometry
.Example// Creates a new geometry based on the difference of two polygons const difference = differenceOperator.execute(polygon1, polygon2);
-
executeMany
executeMany(geometries, subtractor){Array<(GeometryUnion|null|undefined)>}
-
Performs the Topological difference operation on the geometry set.
Parametersgeometries GeometryUnion[]The set of geometry instance to be subtracted by the
subtractor
. All the geometries must have the same spatial reference.subtractor GeometryUnionThe geometry on the right hand side being subtracted.
ReturnsType Description Array<(GeometryUnion|null|undefined)> Returns an array whose elements are the result of subtracting each input geometry from geometries
, or null. The result has the dimensions of thegeometries
.