0% found this document useful (0 votes)
11 views1 page

Distancia V 2

This function calculates the distance between two points on Earth given the latitude and longitude of each point. It uses trigonometric functions and radians to calculate the great-circle distance between the points.

Uploaded by

Paste Lozo
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Distancia V 2

This function calculates the distance between two points on Earth given the latitude and longitude of each point. It uses trigonometric functions and radians to calculate the great-circle distance between the points.

Uploaded by

Paste Lozo
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Untitled Function Distancia(lat1, lon1, lat2, lon2 As Double) As Double Dim Pi As Double Dim D As Double Dim R As Double Dim

x1, x2, x3, x4 As Double Pi = 3.14159265358979 'R = 6369000 R = 6378.388 x1 = (lat1 * Pi) / 180 x2 = (lat2 * Pi) / 180 x3 = (lon1 * Pi) / 180 x4 = (lon2 * Pi) / 180 If lat1 = lat2 And lon1 = lon2 Then D = 0 Else D = (Sin(x1) * Sin(x2) + Cos(x1) * Cos(x2) * Cos(x4 - x3)) D = (Atn(-1 * D / Sqr(-D * D + 1)) + 2 * Atn(1)) * R End If Distancia = D End Function

Page 1

You might also like