Calculate Distance in Km and Miles

蹲街弑〆低调 提交于 2020-01-02 05:50:48

问题


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.



来源:https://stackoverflow.com/questions/6264571/calculate-distance-in-km-and-miles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!