▾
import { proximityGetNearestCoordinate, getNearestCoordinate, proximityGetNearestVertex, getNearestVertex, proximityGetNearestVertices } from "@arcgis/core/geometry/operators/proximityOperator.js";const { proximityGetNearestCoordinate, getNearestCoordinate, proximityGetNearestVertex, getNearestVertex, proximityGetNearestVertices } = await $arcgis.import("@arcgis/core/geometry/operators/proximityOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Find the closest vertices of the 2D geometry.

Type definitions
ProximityOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
unit
- Type
- LengthUnit | undefined
The length unit of the search radius and result distances. The default is the input geometry's spatial reference unit. An error will be thrown if this is set for Geographic Coordinate Systems.
ProximityGetNearestCoordinateOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
- Supertypes
- ProximityOptions
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
- ProximityGetNearestCoordinateOptions
Functions
proximityGetNearestCoordinate
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Returns the nearest coordinate on the geometry to the given input point.
- Signature
-
proximityGetNearestCoordinate (geometry: GeometryUnion, point: Point, options?: ProximityGetNearestCoordinateOptions): 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 proximity result which contains the nearest coordinate on the input
geometryto the givenpoint.
- Example
- // Return the nearest result on a polygon to the given pointconst proximityResult = proximityGetNearestCoordinate(polygon, point);
getNearestCoordinate
Returns the nearest coordinate on the geometry to the given input point.
- Signature
-
getNearestCoordinate (geometry: GeometryUnion, point: Point, options?: ProximityGetNearestCoordinateOptions): 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 proximity result which contains the nearest coordinate on the input
geometryto the givenpoint.
- Example
- // Return the nearest result on a polygon to the given pointconst proximityResult = proximityGetNearestCoordinate(polygon, point);
proximityGetNearestVertex
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Returns the nearest vertex on the geometry.
- Signature
-
proximityGetNearestVertex (geometry: GeometryUnion, point: Point, options?: ProximityOptions): 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 proximity result which contains the nearest vertex on the
geometryto the givenpoint.
- Example
- // Return the nearest vertex on a polygon to the given pointconst proximityResult = proximityGetNearestVertex(polygon, point);
getNearestVertex
Returns the nearest vertex on the geometry.
- Signature
-
getNearestVertex (geometry: GeometryUnion, point: Point, options?: ProximityOptions): 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 proximity result which contains the nearest vertex on the
geometryto the givenpoint.
- Example
- // Return the nearest vertex on a polygon to the given pointconst proximityResult = proximityGetNearestVertex(polygon, point);
proximityGetNearestVertices
- 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
-
proximityGetNearestVertices (geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: ProximityOptions): ProximityResult[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest vertices in | | |
| searchRadius | The planar distance from the | | |
| maxVertexCountToReturn | The maximum number of vertices that will be returned. Must be a positive number. | | |
| options | Additional options. | |
- Returns
- ProximityResult[]
Returns an array of proximity results which contain the nearest vertices on
geometryto the givenpointthat are less than or equal to the planar distance of search radius. The array is sorted by distance to the query point, with the closest vertex first. When there are more than themaxVertexCountToReturnvertices to return, it returns the closest vertices. The array will be empty whengeometryis empty.
- Example
- // Return the nearest vertices on a polygon to the given pointconst proximityResultsArray = proximityGetNearestVertices(polygon, 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?: ProximityOptions): ProximityResult[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| point | The point used to search for the nearest vertices in | | |
| searchRadius | The planar distance from the | | |
| maxVertexCountToReturn | The maximum number of vertices that will be returned. Must be a positive number. | | |
| options | Additional options. | |
- Returns
- ProximityResult[]
Returns an array of proximity results which contain the nearest vertices on
geometryto the givenpointthat are less than or equal to the planar distance of search radius. The array is sorted by distance to the query point, with the closest vertex first. When there are more than themaxVertexCountToReturnvertices to return, it returns the closest vertices. The array will be empty whengeometryis empty.
- Example
- // Return the nearest vertices on a polygon to the given pointconst proximityResultsArray = proximityGetNearestVertices(polygon, point, 100, 5);
Variables
proximitySupportsCurves
- 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
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- ReturnType