I'm developing an application where I show the user's movements on a map using GPS coordinates. Calculating the size of the movement between two location with loc1.distanceTo (loc2), where loc1 and 2 are of type Location. How can I calculate the angle (in degrees) of the movement?
Asked
Active
Viewed 3,066 times
0
-
Do you mean to calculate the slope. – Abhijit Chakra May 22 '13 at 08:26
-
I want to calculate how many degrees the 2nd target is rotated relative to the first – Giammy May 22 '13 at 08:29
1 Answers
3
Did you do a search before you asked? This has been answered several times before. You can get the bearing (which I guess is what you mean by angle) through Location.bearingTo(). In your case it would be:
loc1.bearingTo(loc2)

britzl
- 10,132
- 7
- 41
- 38
-
But the angle is relative to the first location or to an x or y axis? what is the reference point? – Giammy May 22 '13 at 11:06
-
-
I supose that loc1 is in the center of the goniometric circunference and i need to find the angle of the movement of loc2 – Giammy May 22 '13 at 13:55