jqueryandroidnavigationanglegeopositioning

How to calculate angle between two Geolocations?


I'm build an app for an Android smartphone with Phonegape and jQuery mobile.

I want to build an app which uses an arrow which points to a given geolocation, so the user knows in which direction he/she has to go to reach that point.
So I need a function or formula which determines an angle (preferably in degrees) to the destination geo position. Does anyone know how I can do this?


Solution

  • What you're looking for is called an azimuth, that is the angle between a given object and the north.

    To find that angle you use the formula: a = arctan(|(y2-y1)/(x2-x1)|) * 180/pi Where point A is (y2,x2) and point B is (y1,x1).

    As to how you do it in code, I have no idea. I don't work with those platforms. Anyone has any input on this?