Thanks, I'm a little confused between setting the MapPosition bearing and rotating the map.
For google maps the below formula for calculating the bearing according to 2 Lat/Lng works for me:
private double getBearing(double lat1, double lng1, double lat2, double lng2) {
double dLon = (lng2 - lng1);
double y = Math.sin(dLon) * Math.cos(lat2);
double x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1)
* Math.cos(lat2) * Math.cos(dLon);
double brng = Math.toDegrees((Math.atan2(y, x)));
return brng;
}
However, when I set this bearing number to the MapPosition's setBearing() just before using it with: animator().animateTo
It doesn't work as expected. There is a difference between Google maps and VTM when using the bearing.
I always want the map to point (rotate) to the direction which I'm heading