import { execute, executeMany, supportsCurves } from "@arcgis/core/geometry/operators/symmetricDifferenceOperator.js";const { execute, executeMany, supportsCurves } = await $arcgis.import("@arcgis/core/geometry/operators/symmetricDifferenceOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Returns the symmetric difference between 2D geometries, also known as exclusive OR, or XOR. The symmetric difference is the union of the geometries minus the intersection.
This operation can be performed only on geometries that have same dimension (e.g. points with points, lines with lines, polygons with polygons or envelopes, etc). Otherwise, the output will be the input geometry of the higher topological dimension.

- See also
Functions
| Name | Return Type | Object |
|---|---|---|
| | ||
| | ||
| |
execute
Performs the symmetric difference (XOR) operation on two geometries.
- Signature
-
execute (leftGeometry: GeometryUnion, rightGeometry: GeometryUnion): GeometryWithoutMeshUnion
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| leftGeometry | The first geometry to be XOR'd. | | |
| rightGeometry | The second geometry to be XOR'd. | |
- Returns
- GeometryWithoutMeshUnion
Returns the symmetric difference of the two geometries. The result has the higher of dimensions of the two geometries.
Example
// Calculate the symmetric difference of two polygons.const differencePolygon = symmetricDifferenceOperator.execute(polygon1, polygon2); executeMany
Performs the symmetric difference (XOR) operation on every geometry in inputGeometries with rightGeometry.
- Signature
-
executeMany (inputGeometries: GeometryUnion[], rightGeometry: GeometryUnion): GeometryWithoutMeshUnion[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| inputGeometries | The set of geometries to be XOR'd by the | | |
| rightGeometry | The geometry being XOR'd with the | |
- Returns
- GeometryWithoutMeshUnion[]
Returns an array of the result geometries.
Variables
supportsCurves
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- boolean