开发者

How can we find the angle between two locations defined by latitude or longitude

开发者 https://www.devze.com 2023-03-21 13:42 出处:网络
I do not want any code but want to get reference that how can w开发者_JS百科e find the angle between two locations defined by Latitude or Longitude...

I do not want any code but want to get reference that how can w开发者_JS百科e find the angle between two locations defined by Latitude or Longitude...

If you do have reference then Please help me to solve my problem...

Thanx in advance....


The formula to calculate bearing is:

θ = atan2( sin(Δlong).cos(lat2), cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong) )

Bearing is a direction to move from one location to another location (starting from north and then clockwise). While angle in 2D starts from the east and then counter clockwise. So if an angle is what you need, later you'll need to add 90 degree to the result and then revert it (add minus).

Reference: http://www.movable-type.co.uk/scripts/latlong.html


try the Atan method

Math.Atan2(x1-x2,y1-y2)            


Try this website, it does all the calculations for you. Whereas the formulas, those can be found on wiki or any other sites. I like this site cos it managed to help me settle a lot of problems. And even if this web tool was developed in San Francisco, even I am from Singapore. This will work.

Latitude and Longitude web tool

0

精彩评论

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