Show / Hide Table of Contents

Method NearestVertex

NearestVertex(Geometry, MapPoint)

Returns a ProximityResult that describes the nearest vertex in the input geometry to the input point.

Declaration
public static ProximityResult? NearestVertex(this Geometry geometry, MapPoint point)
Parameters
Type Name Description
Geometry geometry

The geometry in which the nearest vertex to a specified point is to be found.

MapPoint point

The point which to find the nearest vertex to.

Returns
Type Description
ProximityResult

The proximity result.

Remarks

If the specified geometry is a polyline or polygon the nearest vertex is the closest ending position of the line segment that comprises geometry; it may not necessarily be the closest point of the line segment. If you want to obtain the closest point in the polyline or polygon use the NearestCoordinate(Geometry, MapPoint) Method instead.

If the specified geometry is an envelope, the geometry will first be converted to a Polygon to perform the calculation of the nearest coordinate. The final PartIndex will always be invalid for an envelope.

Input geometries with true curves (where HasCurves is true) are supported, although curve segments do not affect the return value.

Exceptions
Type Condition
ArgumentException

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

See Also
NearestCoordinate(Geometry, MapPoint)

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8
Relevant samples
Nearest vertex: Find the closest vertex and coordinate of a geometry to a point.
In this article
Provide feedback
Back to top Copyright © 2025 Esri.