1


My requirement is MAX_ZOOM_LEVEL = 14. Calculating zoom using bounds zoom more than MAX_ZOOM_LEVEL.

LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
    if (i < maxNearestMarkers) {
       boundsBuilder.include(marker.getPosition());
}

CameraUpdate boundCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, width,height,padding);

map.animateCamera(boundCameraUpdate);

CameraUpdate class

public final class CameraUpdate {
    private final zzd zzaRp;

    CameraUpdate(zzd remoteObject) {
        this.zzaRp = (zzd)zzx.zzz(remoteObject);
    }

    public zzd zzzH() {
        return this.zzaRp;
    }
}

so how to get zoom level before animating camera to new CameraUpdate.

I required something like algo given below before map.animateCamera(boundCameraUpdate);

if cameraUpdate.zoom > MAX_ZOOM_LEVEL
then cameraUpdate.zoom = MAX_ZOOM_LEVEL

THANKSSS

Note: already doing so but it's zoom in and bounce back to MAX_ZOOM_LEVEL

@Override
public void onCameraChange(CameraPosition cameraPosition) {
     mZoom = cameraPosition.zoom;
     Log.d("Zoom", String.valueOf(cameraPosition.zoom));
     if (cameraPosition.zoom > MAX_ZOOM_LEVEL) {
        map.animateCamera(CameraUpdateFactory.zoomTo(MAX_ZOOM_LEVEL));
    }
}
Qamar
  • 4,959
  • 1
  • 30
  • 49
  • map.animateCamera(CameraUpdateFactory.newLatLngZoom(MAX_ZOOM_LEVEL, 16)); – mujjuraja Jul 27 '16 at 12:28
  • 2
    In my experience the code that you added in your note is the best approach despite the bouncing effect. Related http://stackoverflow.com/questions/15700808/setting-max-zoom-level-in-google-maps-android-api-v2 and https://code.google.com/p/gmaps-api-issues/issues/detail?id=4663 – antonio Jul 27 '16 at 12:52
  • @antonio there should be way out – Qamar Jul 28 '16 at 07:19

0 Answers0