2

I use android-maps-utils and I would like to know if this scenario is possible:

  1. MapFragment is running and pins/marker are clustered
  2. User go to list of markers and go to detail of chosen marker
  3. User go from details to map and would like to see chosen marker centered and de-clustered

Is it possible to adjust zoom level to de-cluster cluster marker and display chosen marker?

//this line will zoom to specific point map.animateCamera(CameraUpdateFactory.newLatLng(fault.getPosition()), null);

I do not know how to de-cluster/zoom to display specific pin, without setting max/min zoom

Unii
  • 1,587
  • 15
  • 33

1 Answers1

5

Try this to adjust zoom level to de-cluster cluster marker:

LatLngBounds.Builder builder = LatLngBounds.builder();
for (ClusterItem item : cluster.getItems()) {
    builder.include(item.getPosition());
}
final LatLngBounds bounds = builder.build();
getMap().animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
pavel
  • 51
  • 3