import { isNearExecute, execute, isNearSupportsCurves, supportsCurves } from "@arcgis/core/geometry/operators/isNearOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.31

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

isNear operator

Type definitions

IsNearOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

unit

Property
Type
LengthUnit | undefined

The length unit of the distance. Unless the unit option is set, the default is the geometry's spatial reference unit. An error will be thrown if this is set for Geographic Coordinate Systems.

Options

deprecated Type definition
Supertypes
IsNearOptions

Functions

isNearExecute

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

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

Signature
isNearExecute (geometry1: GeometryUnion, geometry2: GeometryUnion, distance: number, options?: IsNearOptions): boolean

Parameters

ParameterTypeDescriptionRequired
geometry1

The first geometry.

geometry2

The second geometry.

distance

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

options

Additional options.

Returns
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 = isNearExecute(point, polyline, 100);

execute

deprecated Function

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

Signature
execute (geometry1: GeometryUnion, geometry2: GeometryUnion, distance: number, options?: IsNearOptions): boolean

Parameters

ParameterTypeDescriptionRequired
geometry1

The first geometry.

geometry2

The second geometry.

distance

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

options

Additional options.

Returns
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 = isNearExecute(point, polyline, 100);

Variables

isNearSupportsCurves

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