Index
Component
GpsToolsNET
Class
Position
Methods
Copy
LatitudeDMS LongitudeDMS LatitudeString LongitudeString Altitude
SetLatitudeDMS SetLongitudeDMS SetAltitude
Distance Bearing Move
IsSameDatum IsSameGrid MakeSameDatum MakeSameGrid
Properties
Latitude Longitude LatitudeRads LongitudeRads
Northing Easting Zone
Datum Grid CustomDatum CustomGrid
ModifiedCount


Position.Distance

GpsTools v2.20 and later

Calculates distance between two Position objects. The Method parameter determines how the
distance is calculated.
Method = 1, Great Circle Distance (in Meters)
If you are unsure about which method to use, then use this method. You will always get an
accurate result over short and long distances.
Earths radius is assumed to be 6,366,710 meters, which results in a nautical mile of 1852 meters.
This method is typically used at sea and air.
Method = 2, Great Circle Distance (in Radians)
The distance is returned in radians. This value should be multiplied by a Earth radius of choice.
Use this method if the standard radius in Method 1 is not what you want.
For instance, the former FAI standard for aviation records used the "FAI
sphere" with radius 6,371,000 meters.
Method = 3, Pythagoras theorem (in Meters)
Use this method if you want to calculate the distance on a grid. Typically used on land maps.
VB.NET sample:
Dim objPos1 As New GpsToolsNET.Position
Dim objPos2 As New GpsToolsNET.Position
Dim distance_in_meters As Double
' Some position
objPos1.Longitude = 50.5
objPos1.Latitude = 40.75
' Some other position
objPos2.Latitude = 30
objPos2.Longitude = 20
' Distance from objPos1 to objPos2
' using Great Circle Distance calculation
distance_in_meters = objPos1.Distance(objPos2,
GpsToolsNET.DistanceMethod.GREAT_CIRCLE_DISTANCE)

See also Shape.Distance and Position.Bearing
Syntax v = object.Distance(Position2, Method)
Part 
Type 
Description 
object 
GpsToolsNET.Position 
An object that evaluates to an GpsToolsNET.Position object. 
Position2 
GpsToolsNET.Position2 
Second object to calculate distance to. 
Method 
DistanceMethod 
Method used to calculate distance. 
v 
double 
Distance. 
100% managed code


