title: Google Map API v3 - Centre Map on Markers
body: <p>I've recently started using Google Maps API v3.</p>
  
  <p>I need to plot some locations (maybe 3 or 4) and at the same time, centre the map on these points - as opposed to manually having to set the long and lat for the map to centre on...</p>
  
  <p>Can someone share some tips, or point me in the right direction? </p>
  
  <p>Thanks in advance!
  Dan </p>
  
  <pre><code>function initialize() {
        var latlng = new google.maps.LatLng(51.50816, 0.02712);
        var myOptions = {
          zoom: 12,
          center: latlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var firstmap = new google.maps.Map(document.getElementById("map"),myOptions);
        //EVENT MARKER
        var point = new google.maps.LatLng(51.50816, 0.02712);
        var marker = new google.maps.Marker({
          position:point,
          map:firstmap,
          title: 'ExCel London',
          draggable:false,
          icon:'images/event.png'
        })
        var contentstring = '&lt;div&gt;Hello World&lt;/div&gt;'
        var infoWindow = new google.maps.InfoWindow({
          content:contentstring
        });
        //HOTEL 1 MARKER
        var point = new google.maps.LatLng(51.503146, -0.113259);
        var marker = new google.maps.Marker({
          position:point,
          map:firstmap,
          title: 'Waterloo Hotel',
          draggable:false,
          icon:'images/flag.png'
        })
        var contentstring = '&lt;div&gt;Hello World&lt;/div&gt;';
        var infoWindow = new google.maps.InfoWindow({
            content:contentstring
        });
        google.maps.event.addListener(marker,'click',function(){
            infoWindow.open(firstmap,marker);
        })
      };
  </code></pre>