AMD:
require(["esri/geometry/operators/containsOperator"], (containsOperator) => { /* code goes here */ });
ESM:
import * as containsOperator from "@arcgis/core/geometry/operators/containsOperator.js";
Object:
esri/geometry/operators/containsOperator
Since: ArcGIS Maps SDK for JavaScript 4.31
beta
Performs a relational operation to determine if one 2D geometry contains another 2D geometry. Geometry A contains geometry B, when B is the intersection of A and B. A contains B is equivalent to B within A. Geometry B can be non-simple geometry.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Accelerate a geometry. | containsOperator | ||
Perform the contains operation on two geometries. | containsOperator |
Method Details
-
accelerateGeometry
accelerateGeometry(geometry){Boolean}
-
Accelerate a geometry. This method prepares the geometry for faster contains operations when the same geometry is tested multiple times (e.g. in a loop with hundreds of iterations).
Parametergeometry GeometryThe geometry to accelerate.
ReturnsType Description Boolean Returns true
if the geometry was successfully accelerated.
-
execute
execute(geometry1, geometry2){Boolean}
-
Perform the contains operation on two geometries.
ParametersReturnsType Description Boolean Returns true
ifgeometry1
containsgeometry2
.Example// Returns true if one geometry contains another const isContained = containsOperator.execute(polygon1, polygon2);