symmetricDifferenceOperator

AMD: require(["esri/geometry/operators/symmetricDifferenceOperator"], (symmetricDifferenceOperator) => { /* code goes here */ });
ESM: import * as symmetricDifferenceOperator from "@arcgis/core/geometry/operators/symmetricDifferenceOperator.js";
Object: esri/geometry/operators/symmetricDifferenceOperator
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.

Property Overview

Name Type Summary Object

Indicates if the operator supports input geometries that contain curves.

symmetricDifferenceOperator

Property Details

supportsCurves

Property
supportsCurves Booleanreadonly

Indicates if the operator supports input geometries that contain curves.

Default Value:true

Method Overview

Name Return Type Summary Object

Performs the symmetric difference (XOR) operation on two geometries.

symmetricDifferenceOperator

Performs the symmetric difference (XOR) operation on every geometry in inputGeometries with rightGeometry.

symmetricDifferenceOperator

Method Details

execute

Method
execute(leftGeometry, rightGeometry){GeometryUnion}

Performs the symmetric difference (XOR) operation on two geometries.

Parameters
leftGeometry GeometryUnion

The first geometry to be XOR'd.

rightGeometry GeometryUnion

The second geometry to be XOR'd.

Returns
Type Description
GeometryUnion 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

Method
executeMany(inputGeometries, rightGeometry){GeometryUnion[]}

Performs the symmetric difference (XOR) operation on every geometry in inputGeometries with rightGeometry.

Parameters
inputGeometries GeometryUnion[]

The set of geometries to be XOR'd by the rightGeometry.

rightGeometry GeometryUnion

The geometry being XOR'd with the inputGeometries.

Returns
Type Description
GeometryUnion[] Returns an array of the result geometries.

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