Alex Rivera | Logout

How to calculate angle between two Geographical/GPS coordinates?

Asked 2012-03-05T11:45:20.073
9

I have two GPS Coordinates

e.g. (Lat1, Long1) and (Lat2,Long2)

Could anybody please help me find the angle between those two points.

Values should be 0-360 degrees.

Edit
Report

1 Answer

10

Taken from this previous SO post:

float dy = lat2 - lat1;
float dx = cosf(M_PI/180*lat1)*(long2 - long1);
float angle = atan2f(dy, dx);
answered 2012-03-05T11:50:36.657

Your Answer