How to calculate the angle between two geographical / GPS coordinates?

I have two GPS coordinates

eg. (Lat1, Long1) and (Lat2, Long2)

Can someone help me find the angle between these two points.

Values ​​should be 0-360 degrees.

+5
source share
2 answers

Suppose you mean the angle, not the angle between the locations: If (lat1, long1) is stored in the object Location loc1and (lat2, long2) is stored in loc2, you get from loc1 to loc2, like this:

float bearing = loc1.bearingTo(loc2);

The result is in degrees east of the true north and its initial base (which is important if loc1 and loc2 are far apart).

Location , . : http://developer.android.com/reference/android/location/Location.html

EDIT: Android , , , ...

+5

this SO post:

float dy = lat2 - lat1;
float dx = cosf(M_PI/180*lat1)*(long2 - long1);
float angle = atan2f(dy, dx);
+4

All Articles