Posted By

Jamie on 03/12/10


Tagged

google maps api zoom fit


Versions (?)

Zoom to Markers in Google Maps API


 / Published in: JavaScript
 

URL: http://blog.jeromeparadis.com/archive/2007/02/08/1468.aspx

Borrowed from Jerome Paradis: http://blog.jeromeparadis.com

  1. function fitMap( map, points ) {
  2. var bounds = new GLatLngBounds();
  3. for (var i=0; i< points.length; i++) {
  4. bounds.extend(points[i]);
  5. }
  6. map.setZoom(map.getBoundsZoomLevel(bounds));
  7. map.setCenter(bounds.getCenter());
  8. }

Report this snippet  

You need to login to post a comment.