Google Map ~ auto set Zoom and center map by markers

 var bounds = new GLatLngBounds();
 for (var i = 0; i < markers.length; i++) {
  var point = markers[i].getPoint();
  bounds.extend(point);
 }
 
 map.setZoom(map.getBoundsZoomLevel(bounds));
 map.setCenter(bounds.getCenter());


http://www.mail-archive.com/google-maps-api@googlegroups.com/msg44894.html

沒有留言:

發佈留言