Calculate Distance in Km and Miles

2019-05-06 22:21发布

问题:

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?

回答1:

You can use the haversine formula to calculate such distances.



回答2:

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



回答3:

   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)];


回答4:

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.