Hitung Jarak (NM)

mail@pastecode.io avatar
unknown
vbscript
7 months ago
493 B
2
Indexable
Never
Public Function DistCalc(Prague_Lati As Double, Prague_Longi As Double, Salzburg_Lati As Double, Salzburg_Longi As Double)
    With WorksheetFunction
        M = Cos(.Radians(90 - Prague_Lati))
        N = Cos(.Radians(90 - Salzburg_Lati))
        O = Sin(.Radians(90 - Prague_Lati))
        P = Sin(.Radians(90 - Salzburg_Lati))
        Q = Cos(.Radians(Prague_Longi - Salzburg_Longi))
        
        DistCalc = .Acos(M * N + O * P * Q) * 6371 * 0,539957
    End With
End Function