title: Google Maps v3 - Setting bounds to center of markers
body: <p>Despite spending all day searching and trying numerous code methods I am still having problems with trying to center and zoom a google map correctly.</p>
  
  <p>I wonder if someone would be so kind as to point out the obvious as to what Im doing wrong in my code.  Everything worked fine in v2 but Im having difficulty updating to v3.</p>
  
  <p>For information
  The map is a small part of a much larger php application, and the needed lat &amp; long map parameters have already been obtained by other methods which are used in the main prog and declared as follows:-</p>
  
  <pre><code>var myDestination=new google.maps.LatLng(e_lat,e_long);
  var myHome=new google.maps.LatLng(h_lat,h_long);
  </code></pre>
  
  <p>Everything seems to be working ok aside from the zoom and center.
  Problematic Code is as follows:-</p>
  
  <pre><code>function initialize()
  {
  
  // set the map properties
  var mapProp = {
    center:myHome,
    zoom:12,
    mapTypeId:google.maps.MapTypeId.ROADMAP
    };
  
  var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
  
  // set the home marker
  var marker_home=new google.maps.Marker({
    position:myHome,
    icon:'house.png'
     });
  
    marker_home.setMap(map);
  
  //set the destination marker  
  var marker_destination=new google.maps.Marker({
    position:myDestination,
    icon:'flag_red.png'
    });
  
    marker_destination.setMap(map);
  
  
  
  //google polyline between the 2 points 
   var myPolyline = [myDestination,myHome];
   var directPath = new google.maps.Polyline({
    path:myPolyline,
    strokeColor:"#0000FF",
    strokeOpacity:0.8,
    strokeWeight:2  
  });
  
  directPath.setMap(map);
  
  
  //  Make an array of the LatLng's of the markers you want to show
  var LatLngList = array (new google.maps.LatLng (e_lat,e_long), new google.maps.LatLng  (h_lat,h_long));
  //  Create a new viewpoint bound
  var bounds = new google.maps.LatLngBounds ();
  //  Go through each...
  for (var i = 0, LtLgLen = LatLngList.length; i &lt; LtLgLen; i++) {
  //  And increase the bounds to take this point
  bounds.extend (LatLngList[i]);
  }
  //  Fit these bounds to the map
  map.fitBounds (bounds);
  
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>
  
  <p>TIA for any help :)</p>