开发者

How do I find the angle between the center of the earth and two latitude-longitude coordinates

开发者 https://www.devze.com 2023-01-29 08:27 出处:网络
I\'ve got two LatLon (latitude-longitude) objects which represent two locations on the surface of the globe. I want to find the angle (in radians) between the center of the earth and these two LatLon

I've got two LatLon (latitude-longitude) objects which represent two locations on the surface of the globe. I want to find the angle (in radians) between the center of the earth and these two LatLon objects.

I'm going to use开发者_开发百科 this angle and the radius of the earth to calculate the arc length between the two locations (I figure this will give better precision than using simple Pythagoras, and be faster than computing the great circle distance).

I already have code to give me the Pythagorean distance and the great circle distance.


Using something like this - how to calculate the angle between two vectors


I thought this at first (after some calc on paper) is this Pythagorean thing?
angle_between_radian = sqrt(deltaLA^2 + deltaLO^2)*PI /180
edit: delta = delta>180?360-delta:delta
We working on sphere then above must wrong ^^.
But this link may help:Calculate distance, bearing and more between Latitude/Longitude points.

0

精彩评论

暂无评论...
验证码 换一张
取 消