Calculate angle between two Latitude/Longitude points

后端 未结 17 1407
故里飘歌
故里飘歌 2020-12-07 17:51

Is there a way to calculate angle between two Latitude/Longitude points?

What I am trying to achieve is to know where the user is heading. For example, user is head

17条回答
  •  青春惊慌失措
    2020-12-07 18:29

    Sample javascript code if the distance between points is less -

    brng = Math.atan2(newLat - oldLat, newLong - oldLong);
    brng = brng * (180 / Math.PI);
    brng = (brng + 360) % 360;
    brng = 360 - brng;
    

提交回复
热议问题