Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A C# library exists that performs a calculation to determine this distance, an example of its usage is provided below. Theory can be found in the attached pdf file. The library has been added to delft-tools\shared\geodesy

No Format
Imports System
Imports Gavaghan.Geodesy

    Public Class VincentyGeodeticProblems

    '//Answers is in meters!
    Shared Function Distance _
        (ByVal Loc1_X As Double, ByVal Loc1_Y As Double, _
    byval Loc2_X as Double, byval Loc2_Y as Double) _
        as Double
       
       
            ' instantiate the calculator
            Dim geoCalc As New GeodeticCalculator()

            ' select a reference elllipsoid
            Dim reference As Ellipsoid = Ellipsoid.WGS84

            ' set loc 1 coordinates
            Dim Loc1 As GlobalCoordinates
            Loc1 = New GlobalCoordinates(Loc1_X, Loc1_Y)

            ' set loc 2 coordinates
            Dim Loc2 As GlobalCoordinates
            Loc2 = New GlobalCoordinates(Loc2_X, Loc2_Y)

            ' calculate the geodetic curve
            Dim geoCurve As GeodeticCurve = _
            geoCalc.CalculateGeodeticCurve(reference, Loc1, Loc2)

                     return geoCurve.EllipsoidalDistance
           
        End function

    End Class