Calculates the shortest distance from a LatLng to a Polyline or Polygon.

Namespace: Reimers.Google.Map.Accessories
Assembly: Reimers.Google.Map (in Reimers.Google.Map.dll) Version: 5.3.95.699 (5.3.95.699)

Syntax

C#
public static double Distance(
	ICoordinates point,
	Polygon line,
	bool closeLine,
	Units unit
)

Parameters

point
Type: Reimers.Core.Maps..::..ICoordinates
The point to calculate from.
line
Type: Reimers.Google.Map..::..Polygon
The line or shape to mesaure to.
closeLine
Type: System..::..Boolean
A Boolean value indicating whether the line should be closed.
unit
Type: Reimers.Core.Maps..::..Units
The unit to measure the distance in.

Return Value

Returns a Double value giving the distance between the LatLng and the Polyline.

Remarks

The distance is calculated as the length of a great circle between 2 point. The distance calculation is based on the mean radius of the Earth. As such the calculation is not accurate for all points of the Earth. The distance should be used only as an indication and should never be used in navigation.

See Also