Calculate distance in km and miles

I have two points whose latitude and longitude I know.

How can I calculate the distance (in km and miles) between them. What are the formulas?

+4
source share
4 answers

You can use the haversine formula to calculate such distances.

+3
source

Use the haversine formula for this ...

Here is a link with java script code for calculating distance

http://www.movable-type.co.uk/scripts/latlong.html

+3
source
A = LAT1, B = LONG1 C = LAT2, D = LONG2 (all converted to radians: degree/57.29577951) IF A = C AND B = D THEN DISTANCE = 0; ELSE IF [SIN(A)SIN(C)+COS(A)COS(C)COS(BD)] > 1 THEN DISTANCE = 3963.1*ARCOS[1]; ELSE DISTANCE=3963.1*ARCOS[SIN(A)SIN(C)+COS(A)COS(C)COS(BD)]; 
+2
source

For an accurate and complete (works with any pair of points) solution, use my geodetic calculator http://geographiclib.sf.net/cgi-bin/GeodSolve . Formulas are given at http://arxiv.org/abs/1102.1215 .

+1
source

All Articles