nearestCoordinate static method
- required Geometry geometry,
- required ArcGISPoint point,
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:
- Use a different spatial reference. Use the GeometryEngine.project method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
- Use the geodetic equivalent, GeometryEngine.nearestCoordinateGeodetic.
Supports true curves.
Parameters:
geometry— A geometry object.point— The point of interest.
Return Value: 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.