nearestCoordinate

Determines the nearest point in the input geometry to the input point using a simple planar measurement. If the specified geometry is a polyline, polygon or envelope, the nearest coordinate is the closest point in any of the segments or the filled interior (if applicable); it may not necessarily be the closest vertex of a segment. If you want to obtain the closest vertex in the geometry, use the GeometryEngine.nearestVertex method instead. For envelopes, the final ProximityResult.partIndex will always be invalid.

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.