I would like to know how to get the distance and bearing between 2 GPS points. I have researched on the haversine formula. Someone told me
The bearing calculation is incorrect, you need to swap the inputs to atan2.
bearing = atan2(sin(long2-long1)*cos(lat2), cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(long2-long1)) bearing = degrees(bearing) bearing = (bearing + 360) % 360
This will give you the correct bearing.