import { intersectionAccelerateGeometry, accelerateGeometry, intersectionExecute, execute, intersectionExecuteMany } from "@arcgis/core/geometry/operators/intersectionOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.31

Create new geometries using the topological intersection of 2D geometries.

Intersection operator

Functions

intersectionAccelerateGeometry

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Accelerate a geometry. This method prepares the geometry for faster intersection operations when the same geometry is tested multiple times (e.g. in a loop with hundreds of iterations). See the Acceleration guide topic for more information.

Signature
intersectionAccelerateGeometry (geometry: GeometryUnion): boolean

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to accelerate.

Returns
boolean

Returns true if the geometry was successfully accelerated.

accelerateGeometry

deprecated Function

Accelerate a geometry. This method prepares the geometry for faster intersection operations when the same geometry is tested multiple times (e.g. in a loop with hundreds of iterations). See the Acceleration guide topic for more information.

Signature
accelerateGeometry (geometry: GeometryUnion): boolean

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to accelerate.

Returns
boolean

Returns true if the geometry was successfully accelerated.

intersectionExecute

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Performs the topological intersection operation on two geometries.

If the input geometries have different dimensions (i.e. point = 0; polyline = 1; polygon = 2), then the result's dimension will be equal to the lowest dimension of the inputs.

The table below describes the expected output for various combinations of geometry types. Note that the geometries are interchangeable in this operation and will return the same result if flipped.

geometry1 typegeometry2 typeResult geometry type
Polygon/ExtentPolygon/ExtentPolygon
Polygon/ExtentPolylinePolyline
PolygonPointPoint
PolygonMultipointMultipoint
PolylinePolylinePolyline
PolylinePointPoint
PolylineMultipointMultipoint
PointPointPoint
MultipointMultipointMultipoint

Note that two intersecting polylines will not return point geometries. Instead, this operator will return polyline paths that are equal or overlap between the two geometries. See intersectionExecuteMany() to find the point intersections of two polylines.

Signature
intersectionExecute (geometry1: GeometryUnion, geometry2: GeometryUnion): GeometryWithoutMeshUnion | null | undefined

Parameters

ParameterTypeDescriptionRequired
geometry1

The geometry to intersect with geometry2.

geometry2

The geometry to intersect with geometry1.

Returns
GeometryWithoutMeshUnion | null | undefined

Returns the result of the intersection of the two geometries or null.

Example
// Creates a new geometry based on the intersection of two polygons
const intersection = intersectionExecute(polygon1, polygon2);

execute

deprecated Function

Performs the topological intersection operation on two geometries.

If the input geometries have different dimensions (i.e. point = 0; polyline = 1; polygon = 2), then the result's dimension will be equal to the lowest dimension of the inputs.

The table below describes the expected output for various combinations of geometry types. Note that the geometries are interchangeable in this operation and will return the same result if flipped.

geometry1 typegeometry2 typeResult geometry type
Polygon/ExtentPolygon/ExtentPolygon
Polygon/ExtentPolylinePolyline
PolygonPointPoint
PolygonMultipointMultipoint
PolylinePolylinePolyline
PolylinePointPoint
PolylineMultipointMultipoint
PointPointPoint
MultipointMultipointMultipoint

Note that two intersecting polylines will not return point geometries. Instead, this operator will return polyline paths that are equal or overlap between the two geometries. See intersectionExecuteMany() to find the point intersections of two polylines.

Signature
execute (geometry1: GeometryUnion, geometry2: GeometryUnion): GeometryWithoutMeshUnion | null | undefined

Parameters

ParameterTypeDescriptionRequired
geometry1

The geometry to intersect with geometry2.

geometry2

The geometry to intersect with geometry1.

Returns
GeometryWithoutMeshUnion | null | undefined

Returns the result of the intersection of the two geometries or null.

Example
// Creates a new geometry based on the intersection of two polygons
const intersection = intersectionExecute(polygon1, polygon2);

intersectionExecuteMany

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Performs the topological intersection operation on the geometry set.

The table below describes the potential results for various combinations of geometry types based on how they intersect. For example, a polyline that touches a polygon would return a multipoint. If the geometries do not intersect, an empty array will be returned.

Input geometry typeIntersector geometry typeResult geometry types
Point/MultipointPoint/MultipointMultipoint
Point/MultipointPolylineMultipoint
Point/MultipointPolygon/ExtentMultipoint
PolylinePoint, MultipointMultipoint
PolylinePolylinePolyline, Multipoint
PolylinePolygon/ExtentPolyline, Multipoint
Polygon/ExtentPoint/MultipointMultipoint
Polygon/ExtentPolylineMultipoint, Polyline
Polygon/ExtentPolygon/ExtentMultipoint, Polyline, Polygon
Signature
intersectionExecuteMany (geometries: GeometryUnion[], intersector: GeometryUnion): GeometryWithoutMeshUnion[]

Parameters

ParameterTypeDescriptionRequired
geometries

The set of input geometries to be intersected by the intersector. All the geometries must have the same spatial reference.

intersector

The geometry to intersect with the geometries.

Returns
GeometryWithoutMeshUnion[]

Returns an array of geometries created by intersecting every geometry in the input geometries with the intersector, or an empty array if there is no intersection.

executeMany

deprecated Function

Performs the topological intersection operation on the geometry set.

The table below describes the potential results for various combinations of geometry types based on how they intersect. For example, a polyline that touches a polygon would return a multipoint. If the geometries do not intersect, an empty array will be returned.

Input geometry typeIntersector geometry typeResult geometry types
Point/MultipointPoint/MultipointMultipoint
Point/MultipointPolylineMultipoint
Point/MultipointPolygon/ExtentMultipoint
PolylinePoint, MultipointMultipoint
PolylinePolylinePolyline, Multipoint
PolylinePolygon/ExtentPolyline, Multipoint
Polygon/ExtentPoint/MultipointMultipoint
Polygon/ExtentPolylineMultipoint, Polyline
Polygon/ExtentPolygon/ExtentMultipoint, Polyline, Polygon
Signature
executeMany (geometries: GeometryUnion[], intersector: GeometryUnion): GeometryWithoutMeshUnion[]

Parameters

ParameterTypeDescriptionRequired
geometries

The set of input geometries to be intersected by the intersector. All the geometries must have the same spatial reference.

intersector

The geometry to intersect with the geometries.

Returns
GeometryWithoutMeshUnion[]

Returns an array of geometries created by intersecting every geometry in the input geometries with the intersector, or an empty array if there is no intersection.

Variables

intersectionSupportsCurves

Variable
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

deprecated Variable

Indicates if the operator supports input geometries that contain curves. The value will always be true.

Type
ReturnType