I have two points whose latitude and longitude i know.
How can i calculate the distance(in Km and Miles) between them. What is the formulae?
I have two points whose latitude and longitude i know.
How can i calculate the distance(in Km and Miles) between them. What is the formulae?
You can use the haversine formula to calculate such distances.
Use the haversine Formula for this...
Here is the link having java script code to calculate distance
http://www.movable-type.co.uk/scripts/latlong.html
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(B-D)] > 1 THEN DISTANCE = 3963.1*ARCOS[1];
ELSE
DISTANCE=3963.1*ARCOS[SIN(A)SIN(C)+COS(A)COS(C)COS(B-D)];
For an accurate and complete (works with any pair of points) solution use my geodesic calculator at http://geographiclib.sf.net/cgi-bin/GeodSolve. The formulas are given in http://arxiv.org/abs/1102.1215.