Posted By

marzsman on 05/14/11


javascript google maps

Versions (?)

Zoom and fit bounds Google maps V3

 / Published in: JavaScript

Center the map on an array of latlng values

  1. var latlngbounds = new google.maps.LatLngBounds();
  2. for ( var i=0; i<route.length; i++ ){
  3. latlngbounds.extend(route[i]);
  4. }
  5. map.setCenter( latlngbounds.getCenter(), map.fitBounds(latlngbounds));

Report this snippet  

You need to login to post a comment.