isNearOperator

AMD: require(["esri/geometry/operators/isNearOperator"], (isNearOperator) => { /* code goes here */ });
ESM: import * as isNearOperator from "@arcgis/core/geometry/operators/isNearOperator.js";
Object: esri/geometry/operators/isNearOperator
Since: ArcGIS Maps SDK for JavaScript 4.31
beta

Performs a 2D relational operation that checks if two geometries are near each other.

Method Overview

Name Return Type Summary Object

Returns true if the geometries are not further than the given 2D distance from each other.

isNearOperator

Method Details

execute

Method
execute(geometry1, geometry2, distance, options){Boolean}

Returns true if the geometries are not further than the given 2D distance from each other.

Parameters
geometry1 Geometry

The first geometry.

geometry2 Geometry

The second geometry.

distance Geometry

The distance (must be positive). Unless the unit option is set, the default is the geometry's spatial reference unit.

options Object
optional

Additional options.

Specification
unit LengthUnit
optional

The length unit of the distance. An error will be thrown if this is set for Geographic Coordinate Systems.

Returns
Type Description
Boolean Returns true if the minimum distance between the two geometries is equal or less than distance.
Example
// Check if two geometries are near each other
const isNear = isNearOperator.execute(point, polyline, 100);

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