title: Google Maps API: Calculate Center/Zoom of Polyline
body: <p>I have an overlay that is dynamically generated from user data, so I need to know how to find the center of that overlay.</p>
  
  <p>Currently, I am just using the first coordinates from the overlay, but that really does not represent the center of the overlay.  Therefore when I load the map, it is not centered on the overlay.</p>
  
  <p>Does anyone have a good method for centering the map on the overlay, by calculating the center, not hard coding it?</p>
  
  <pre><code>var latlng = new google.maps.LatLng(38.269239, -122.276010);
      var myOptions = {
          zoom: 15,//Calculate this somehow?
          center: latlng,// Calculate value from array of coordinates?
          mapTypeId: google.maps.MapTypeId.HYBRID
      };
  </code></pre>