How to set the Google Map zoom level to show all the markers?

后端 未结 4 1876
时光取名叫无心
时光取名叫无心 2020-12-08 00:36

How do I set the zoom level to show all the markers on Google Maps?

In my Google Map there are different markers in different positions. I want to set google map zoo

4条回答
  •  春和景丽
    2020-12-08 01:20

    There you go:

    
     
     
        
       Google Maps getBoundsZoomLevel Demo 
        
     
     
    
       

    We are creating 10 random points in the above example and then passing each point to GLatLngBounds.extend(). Finally we get the correct zoom level with GMap2.getBoundsZoomLevel().

    Google Maps getBoundsZoomLevel Demo

提交回复
热议问题