A sin² Df2 cos f1 cos f2 sin² Dl2 c 2 atan2 a 1a d R c. Displaystyle R_ 1 frac 1 3 2abapprox 6371009mathrm km for the WGS84 ellipsoid means that in the limit of small flattening the mean square relative error in the estimates for distance is minimized. Distance d 39630 arccossinlat1 sinlat2 coslat1 coslat2 coslong2 long1 The obtained distance d is in miles.
The one which uses haversine formula and the another one which uses Vincenty formula.
The haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudesImportant in navigation it is a special case of a more general formula in spherical trigonometry the law of haversines that relates the sides and angles of spherical triangles. The distance between two point on earth is as following. In the haversine formula d is the distance between two points along a great circle r is the radius of the sphere ϕ 1 and ϕ 2 are the latitudes of the two points and l 1 and l 2 are the longitudes of the two points all in radians. Alternatively you can use a latitude and longitude calculator which uses an algorithm based on the formula to find the distance.