▾
import { differenceExecute, execute, differenceExecuteMany, executeMany, differenceSupportsCurves } from "@arcgis/core/geometry/operators/differenceOperator.js";const { differenceExecute, execute, differenceExecuteMany, executeMany, differenceSupportsCurves } = await $arcgis.import("@arcgis/core/geometry/operators/differenceOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Performs a topological difference operation on 2D geometries.

Functions
differenceExecute
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Performs the topological difference operation on the two geometries.
- Signature
-
differenceExecute (geometry: GeometryUnion, subtractor: GeometryUnion): GeometryWithoutMeshUnion | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The geometry instance on the left-hand side of the subtraction. | | |
| subtractor | The geometry on the right-hand side being subtracted. | |
- Returns
- GeometryWithoutMeshUnion | 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 polygonsconst difference = differenceExecute(polygon1, polygon2);
execute
Performs the topological difference operation on the two geometries.
- Signature
-
execute (geometry: GeometryUnion, subtractor: GeometryUnion): GeometryWithoutMeshUnion | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The geometry instance on the left-hand side of the subtraction. | | |
| subtractor | The geometry on the right-hand side being subtracted. | |
- Returns
- GeometryWithoutMeshUnion | null | undefined
Returns the result of the subtraction from the
geometry, or null. The result has the same dimensions asgeometry.
- Example
- // Creates a new geometry based on the difference of two polygonsconst difference = differenceExecute(polygon1, polygon2);
differenceExecuteMany
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Performs the topological difference operation on the geometry set.
- Signature
-
differenceExecuteMany (geometries: GeometryUnion[], subtractor: GeometryUnion): (GeometryWithoutMeshUnion | null | undefined)[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometries | The set of geometry instances to be subtracted by the | | |
| subtractor | The geometry on the right-hand side being subtracted. | |
- Returns
- (GeometryWithoutMeshUnion | null | undefined)[]
Returns an array whose elements are the result of subtracting
subtractorfrom each input geometry ingeometries. Individual entries may benullorundefined. Each result has the dimensions of its corresponding input geometry.
executeMany
Performs the topological difference operation on the geometry set.
- Signature
-
executeMany (geometries: GeometryUnion[], subtractor: GeometryUnion): (GeometryWithoutMeshUnion | null | undefined)[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometries | An array of geometries. All the geometries must have the same spatial reference. | | |
| subtractor | The geometry to be subtracted from each and every geometry in | |
- Returns
- (GeometryWithoutMeshUnion | null | undefined)[]
Returns an array whose elements are the result of subtracting
subtractorfrom each input geometry ingeometries. Individual entries may benullorundefined. Each result has the dimensions of its corresponding input geometry.
Variables
differenceSupportsCurves
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- boolean
supportsCurves
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- ReturnType