nearestCoordinate

Determines the nearest point in the input geometry to the input point using a simple planar measurement. Input geometry of type Envelope is not supported. To find the nearest coordinate on an Envelope, convert it to a Polygon first using GeometryEngine.boundaryOrNull.

If the specified geometry is a polyline or polygon the nearest coordinate is the closest point in a segment that comprises geometry; it may not necessarily be the closest vertex of a segment. If you want to obtain the closest vertex in the polyline or polygon use the GeometryEngine.nearestVertex method instead.

This calculation uses 2D Cartesian mathematics to compute the nearest coordinate. It is based upon the SpatialReference of the input geometries. If the input geometries do not use an 'distance preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

Supports true curves.

Return

A ProximityResult containing the results of the operation. This is null if the input geometry is empty. ProximityResult.distance is zero if the point lies inside an input polygon, polyline, or envelope.

Since

200.1.0

Parameters

geometry

A geometry object.

point

The point of interest.

Throws

Indicates that geometry and point do not have equivalent spatial references.