Getting map zoom level for given bounds on Android like on JS Google Maps API: map.getBoundsZoomLevel(bounds)

前端 未结 3 1873
臣服心动
臣服心动 2021-02-09 10:23

I have a cluster marker that defines a bounding rectangle containing a group of markers. The cluster has a center (lat,lon), a marker count and a latitude and longitude span to

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 11:07

    Now you could zoom to bounds with .newLatLngBounds() method:

    map.animateCamera(CameraUpdateFactory.newLatLngBounds(place.getViewport(), 10)); // 10 is padding
    

    It will move and zoom to given bounds, so they all visible on a screen (e.g. different zoom for city or country). It works perfectly with location search.

提交回复
热议问题