I have been trying this formula to obtain the azimut/bearing of two points of the map.
I mean, to obtain the real north di开发者_StackOverflow中文版rection of the vector done with the two coordinates.
θ =atan2(sin(Δlong).cos(lat2),cos(lat1).sin(lat2)−sin(lat1).cos(lat2).cos(Δlong))
azimut=θ*180/M_PI;
azimuth=(azimuth+360)MOD 360;
I have obtain this formula from this webpage(http://www.yourhomenow.com/house/haversine.html), but i never get the same result.
Is there any other way to obtain the azimut of two points?
Thanks!
You also need to have Δlong
, lat1
and lat2
in radians. Therefore you should multiply all of them by M_PI/180
before starting the calculation.
精彩评论