import { geodesicProximityIsLoaded, isLoaded, geodesicProximityLoad, load, geodesicProximityGetNearestCoordinate } from "@arcgis/core/geometry/operators/geodesicProximityOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.31

Finds closest vertices of a 2D geometry using geodesic distance.

Notes

Verify that isLoaded() returns true before using this module. Use load() to load this module's dependencies.

Geodesic proximity operator

Type definitions

GeodesicProximityOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

unit

Property
Type
LengthUnit | undefined

The length unit of the result distance.

Default value
"meters"

Options

deprecated Type definition

GeodesicProximityGetNearestCoordinateOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

calculateLeftRightSide

Property
Type
boolean | undefined

When the parameter is set to true, this function will calculate the left/right side of a polyline or polygon. Look for the result in the isRightSide property of the returned ProximityResult object.

Default value
false

maxDeviation

Property
Type
number | undefined

The value controls the error of calculation. The method uses shape preserving densification to approximate the input segments with great piecewise elliptical arcs. When the value is zero or NaN, internally the operator uses 0.01 meters. For other values, unless the unit option is set, the default is meters.

Default value
NaN

testPolygonInterior

Property
Type
boolean | undefined

When geometry is a polygon, the function will test if point is inside of the polygon. Points that are inside of the polygon have zero distance to the polygon. When set to false, the function will not check if the point is inside of the polygon, but will only determine proximity to the boundary.

Default value
true

GetNearestCoordinateOptions

deprecated Type definition

Functions

geodesicProximityIsLoaded

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if all dependencies of this module have been loaded.

Signature
geodesicProximityIsLoaded (): boolean
Returns
boolean

Returns true if this module's dependencies have been loaded.

isLoaded

deprecated Function

Indicates if all dependencies of this module have been loaded.

Signature
isLoaded (): boolean
Returns
boolean

Returns true if this module's dependencies have been loaded.

geodesicProximityLoad

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Loads this module's dependencies. This method must be called first if geodesicProximityIsLoaded returns false.

See also
Signature
geodesicProximityLoad (): Promise<void>
Returns
Promise<void>

Resolves when the dependencies have been loaded.

load

deprecated Function

Loads this module's dependencies. This method must be called first if isLoaded returns false.

See also
Signature
load (): Promise<void>
Returns
Promise<void>

Resolves when the dependencies have been loaded.

geodesicProximityGetNearestCoordinate

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Returns the nearest coordinate on the geometry to the given input point. The operator interprets all segments in a shape-preserving manner, that is, it treats segments as if they are densified with a small step in the input spatial reference and then the calculation is performed geodesically.

Signature
geodesicProximityGetNearestCoordinate (geometry: GeometryUnion, point: Point, options?: GeodesicProximityGetNearestCoordinateOptions): ProximityResult

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

point

The point used to search for the nearest coordinate in geometry.

options

Additional options.

Returns
ProximityResult

Returns the result of proximity operation.

Example
if (!geodesicProximityIsLoaded()) {
await geodesicProximityLoad();
}
// Calculate the nearest coordinate on a polyline to the given point
const result = geodesicProximityGetNearestCoordinate(polyline, point);

getNearestCoordinate

deprecated Function

Returns the nearest coordinate on the geometry to the given input point. The operator interprets all segments in a shape-preserving manner, that is, it treats segments as if they are densified with a small step in the input spatial reference and then the calculation is performed geodesically.

Signature
getNearestCoordinate (geometry: GeometryUnion, point: Point, options?: GeodesicProximityGetNearestCoordinateOptions): ProximityResult

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

point

The point used to search for the nearest coordinate in geometry.

options

Additional options.

Returns
ProximityResult

Returns the result of proximity operation.

Example
if (!geodesicProximityIsLoaded()) {
await geodesicProximityLoad();
}
// Calculate the nearest coordinate on a polyline to the given point
const result = geodesicProximityGetNearestCoordinate(polyline, point);

geodesicProximityGetNearestVertex

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Returns the nearest vertex on the geometry.

Signature
geodesicProximityGetNearestVertex (geometry: GeometryUnion, point: Point, options?: GeodesicProximityOptions): ProximityResult

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

point

The point used to search for the nearest vertex in the input geometry.

options

Additional options.

Returns
ProximityResult

Returns the result of proximity operation.

Example
if (!geodesicProximityIsLoaded()) {
await geodesicProximityLoad();
}
// Calculate the nearest vertex on a polyline to the given point
const result = geodesicProximityGetNearestVertex(polyline, point);

getNearestVertex

deprecated Function

Returns the nearest vertex on the geometry.

Signature
getNearestVertex (geometry: GeometryUnion, point: Point, options?: GeodesicProximityOptions): ProximityResult

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

point

The point used to search for the nearest vertex in the input geometry.

options

Additional options.

Returns
ProximityResult

Returns the result of proximity operation.

Example
if (!geodesicProximityIsLoaded()) {
await geodesicProximityLoad();
}
// Calculate the nearest vertex on a polyline to the given point
const result = geodesicProximityGetNearestVertex(polyline, point);

geodesicProximityGetNearestVertices

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Returns vertices of the geometry that are closer to the given point than the given radius.

Signature
geodesicProximityGetNearestVertices (geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: GeodesicProximityOptions): ProximityResult[]

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

point

The point used to search for the nearest vertices in geometry.

searchRadius

The distance to search from the point to the nearest vertices in the geometry. Unless the unit option is set, the default is meters.

maxVertexCountToReturn

The maximum number of vertices that will be returned. Must be a positive number.

options

Additional options.

Returns
ProximityResult[]

The array of vertices that are in the given search radius to the point. The array is sorted by distance to the query point, with the closest vertex first. When there are more than the maxVertexCountToReturn vertices to return, it returns the closest vertices. The array will be empty when geometry is empty.

Example
if (!geodesicProximityIsLoaded()) {
await geodesicProximityLoad();
}
// Calculate the nearest vertices on a polyline to the given point
const result = geodesicProximityGetNearestVertices(polyline, point, 100, 5);

getNearestVertices

deprecated Function

Returns vertices of the geometry that are closer to the given point than the given radius.

Signature
getNearestVertices (geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: GeodesicProximityOptions): ProximityResult[]

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

point

The point used to search for the nearest vertices in geometry.

searchRadius

The distance to search from the point to the nearest vertices in the geometry. Unless the unit option is set, the default is meters.

maxVertexCountToReturn

The maximum number of vertices that will be returned. Must be a positive number.

options

Additional options.

Returns
ProximityResult[]

The array of vertices that are in the given search radius to the point. The array is sorted by distance to the query point, with the closest vertex first. When there are more than the maxVertexCountToReturn vertices to return, it returns the closest vertices. The array will be empty when geometry is empty.

Example
if (!geodesicProximityIsLoaded()) {
await geodesicProximityLoad();
}
// Calculate the nearest vertices on a polyline to the given point
const result = geodesicProximityGetNearestVertices(polyline, point, 100, 5);

Variables

geodesicProximitySupportsCurves

Variable
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if the operator supports input geometries that contain curves. The value is null or undefined until the operator is loaded, then it will always be true.

Type
boolean | null | undefined

supportsCurves

deprecated Variable

Indicates if the operator supports input geometries that contain curves. The value is null or undefined until the operator is loaded, then it will always be true.

Type
boolean | null | undefined