How to determine the direction of two geo-points

I have 3 geography points

(starting position) 11.986242477259117, 79.84657287597656

(middle position) 11.984521304799278, 79.84583258628845

(end position) 11.985014568760436, 79.844491481781

I get knowledge from How to draw a path on a map using kml file?

and I highlighted the line between the points of the geometry.

enter image description here

I calculated the distance using How to calculate the distance between two points using their longitude and latitude

My question is: when the user is standing next to "A" (starting position), I want to say the direction, you go to "North", "East", "West", "South" like this.

If the user mistakenly moves in another direction, you need to say that "you hav mov the wrong direction" and say the right direction.

How to get the direction between two points of geometry.?

I get degee from Get direction (compass) with two points of longitude / latitude

it returns some degree, but I cannot tell the right direction.

How to get the direction between two points of geometry.?

+6
source share

Source: https://habr.com/ru/post/922108/


All Articles