▾
import { geodesicProximityIsLoaded, isLoaded, geodesicProximityLoad, load, geodesicProximityGetNearestCoordinate } from "@arcgis/core/geometry/operators/geodesicProximityOperator.js";const { geodesicProximityIsLoaded, isLoaded, geodesicProximityLoad, load, geodesicProximityGetNearestCoordinate } = await $arcgis.import("@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.

Type definitions
GeodesicProximityOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
unit
- Type
- LengthUnit | undefined
The length unit of the result distance.
- Default value
- "meters"
GeodesicProximityGetNearestCoordinateOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
- Supertypes
- GeodesicProximityOptions
maxDeviation
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
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
- Supertypes
- GeodesicProximityGetNearestCoordinateOptions
Functions
geodesicProximityIsLoaded
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Indicates if all dependencies of this module have been loaded.
- Signature
-
geodesicProximityIsLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
isLoaded
Indicates if all dependencies of this module have been loaded.
- Signature
-
isLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
geodesicProximityLoad
- 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>
load
Loads this module's dependencies. This method must be called first if isLoaded returns false.
- See also
- Signature
-
load (): Promise<void>
geodesicProximityGetNearestCoordinate
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest coordinate in | | |
| 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 pointconst result = geodesicProximityGetNearestCoordinate(polyline, point);
getNearestCoordinate
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest coordinate in | | |
| 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 pointconst result = geodesicProximityGetNearestCoordinate(polyline, point);
geodesicProximityGetNearestVertex
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest vertex in the input | | |
| 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 pointconst result = geodesicProximityGetNearestVertex(polyline, point);
getNearestVertex
Returns the nearest vertex on the geometry.
- Signature
-
getNearestVertex (geometry: GeometryUnion, point: Point, options?: GeodesicProximityOptions): ProximityResult
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest vertex in the input | | |
| 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 pointconst result = geodesicProximityGetNearestVertex(polyline, point);
geodesicProximityGetNearestVertices
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest vertices in | | |
| searchRadius | The distance to search from the | | |
| 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
maxVertexCountToReturnvertices to return, it returns the closest vertices. The array will be empty whengeometryis empty.
- Example
- if (!geodesicProximityIsLoaded()) {await geodesicProximityLoad();}// Calculate the nearest vertices on a polyline to the given pointconst result = geodesicProximityGetNearestVertices(polyline, point, 100, 5);
getNearestVertices
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest vertices in | | |
| searchRadius | The distance to search from the | | |
| 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
maxVertexCountToReturnvertices to return, it returns the closest vertices. The array will be empty whengeometryis empty.
- Example
- if (!geodesicProximityIsLoaded()) {await geodesicProximityLoad();}// Calculate the nearest vertices on a polyline to the given pointconst result = geodesicProximityGetNearestVertices(polyline, point, 100, 5);