LineDistanceTo Method | |
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Calculates the shortest distance from the given point to this Line.
Namespace:
Telogis.GeoBase
Assembly:
geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax public override double DistanceTo(
LatLon location,
DistanceUnit units
)
Public Overrides Function DistanceTo (
location As LatLon,
units As DistanceUnit
) As Double
Parameters
- location
- Type: Telogis.GeoBaseLatLon
The given point, as a LatLon - units
- Type: Telogis.GeoBaseDistanceUnit
Unit that measurement is returned in.
Return Value
Type:
DoubleDistance in units.
Remarks
This distance is calculated using an arc, as opposed to the (longer) straight-line distance.
The use of an arc returns the true shortest distance, taking into account the curvature of
the earth's surface.
Examples
Telogis.GeoBase.Line lineExample = new Telogis.GeoBase.Line(
new Telogis.GeoBase.Geometry.LineString[] {
new Telogis.GeoBase.Geometry.LineString(
new LatLon(33.458781,-117.673489),
new LatLon(33.453646,-117.665022))
}
);
LatLon pointExample = new LatLon(33.471842, -117.657561);
Console.WriteLine("Shortest distance from line to point is {0} miles",
lineExample.DistanceTo(pointExample, DistanceUnit.MILES).ToString("0.0"));
See Also