Calculate distance between 2 GPS coordinates

前端 未结 29 4055
青春惊慌失措
青春惊慌失措 2020-11-21 23:34

How do I calculate distance between two GPS coordinates (using latitude and longitude)?

29条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-21 23:54

    I guess you want it along the curvature of the earth. Your two points and the center of the earth are on a plane. The center of the earth is the center of a circle on that plane and the two points are (roughly) on the perimeter of that circle. From that you can calculate the distance by finding out what the angle from one point to the other is.

    If the points are not the same heights, or if you need to take into account that the earth is not a perfect sphere it gets a little more difficult.

提交回复
热议问题