With these it helps I'm writing an Android app and integrating GoogleMapsV2 API. I have a series of markers on the map at various locations around an anchor. , probably needs 360.0

```
double calcBearing = (Math.toDegrees(Math.atan2(y, x))+360.0)%360.0;
```

```
LatLon ll;
Point p = mMap.getProjection().toScreenLocation(ll);
```

```
final Handler handler = new Handler();
final long start = SystemClock.uptimeMillis();
final long duration = 2500;
final Interpolator interpolator = new BounceInterpolator();
handler.post(new Runnable() {
@Override
public void run() {
long elapsed = SystemClock.uptimeMillis() - start;
float t = Math.max(
1 - interpolator.getInterpolation((float) elapsed
/ duration), 0);
marker.setAnchor(0.5f, 1.0f + 6 * t);
if (t > 0.0) {
// Post again 16ms later.
handler.postDelayed(this, 16);
}
}
});
```

```
// Define the callback method that receives location updates
@Override
public void onLocationChanged(Location location) {
// Given the bearing, speed, and current location
// calculate what the expected location is traveling for an
// interval that is slightly larger than two times fastest interval of
// the location provider and animate the map movement to the
// expected location over the same slightly larger interval.
// In Theory by using an interval that is slightly larger
// than two times fastest interval of the location provider for the
// animation length a new animation will start before the
// currently running animation finishes. This should ensure a
// smooth animation of the map while traveling under most
// circumstances.
// Negative acceleration (braking)
// should have acceptable map animation because the map
// animation in theory never finishes.
// Note longer intervals, large negative accelerations, just
// braking at the start of an interval may result in the map moving
// backwards. But it will still be animated.
// Some handhelds might not be able to keep up
// TODO CHECK THE age of the location
// location.getSpeed() =meters/second
// interval 1/1000 seconds
// distance in radians km/6371
// changed.
// (location.getSpeed()m/s)(1/1000 interval seconds)( 1/1000 km/m)
// (1/6371 radians/km) = radians/6371000000.0
double expectedDistance = location.getSpeed() * expectedDistMultiplier;
// latitude in Radians
double currentLatitude = Math.toRadians(location.getLatitude());
// longitude in Radians
double longitude1 = Math.toRadians(location.getLongitude());
double bearing;
bearing = (location.hasBearing()) ? Math.toRadians(location
.getBearing()) : 0;
// calculate the expected latitude and longitude based on staring
// location
// , bearing, and distance
double expectedLatitude = Math.asin(Math.sin(currentLatitude)
* Math.cos(expectedDistance) + Math.cos(currentLatitude)
* Math.sin(expectedDistance) * Math.cos(bearing));
double a = Math.atan2(
Math.sin(bearing) * Math.sin(expectedDistance)
* Math.cos(currentLatitude),
Math.cos(expectedDistance) - Math.sin(currentLatitude)
* Math.sin(expectedLatitude));
double expectedLongitude = longitude1 + a;
expectedLongitude = (expectedLongitude + 3 * Math.PI) % (2 * Math.PI)
- Math.PI;
// convert to degrees for the expected destination
double expectedLongitudeDestination = Math.toDegrees(expectedLongitude);
double expectedLatitudeDestination = Math.toDegrees(expectedLatitude);
// log everything for testing.
Log.d("Location", "Bearing in radians" + bearing);
Log.d("Location", "distance in km" + expectedDistance);
Log.d("Location", "Current Latitude = " + location.getLatitude()
+ " Current Longitude = " + location.getLongitude());
Log.d("Location", "New Latitude = " + expectedLatitudeDestination
+ " New Longitude = " + expectedLongitudeDestination);
// build a camera update to animate positioning map to the expected
// destination
LatLng ll = new LatLng(expectedLatitudeDestination,
expectedLongitudeDestination);
CameraPosition.Builder cb = CameraPosition.builder()
.zoom(mMap.getCameraPosition().zoom)
.bearing(mMap.getCameraPosition().bearing)
.tilt(mMap.getCameraPosition().tilt).target(ll);
if (location.hasBearing()) {
cb.bearing(location.getBearing());
}
CameraPosition camera = cb.build();
CameraUpdate update = CameraUpdateFactory.newCameraPosition(camera);
mMap.animateCamera(update, interval, this);
}
```