title: Get bounding box of polygon
body: <p>I have many complicated polygons some with 750+ points. <strong>Is there an fast and efficient way to get bounding box?</strong> I would hate to loop throught every point and expand the bounding box..</p>
  
  <p>Solution should be in <a href="/questions/tagged/javascript" class="post-tag" title="show questions tagged &#39;javascript&#39;" rel="tag">javascript</a> or maybe there's a Google Maps API v3 function that I've missed.</p>
  
  <hr>
  
  <p>Or should I hardcode the coordinates of bounding box and use these to decrease the load on client?</p>
  
  <p><a href="https://i.stack.imgur.com/JJuSI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JJuSI.png" alt="enter image description here"></a></p>
  
  <p><strong>How polygons are made:</strong></p>
  
  <pre><code>//Coordinates
  var coordinates = [ 
      new google.maps.LatLng(11,22),
      new google.maps.LatLng(11,22),
      new google.maps.LatLng(11,22),
  
      //etc up to 200, 500 or even 800 points
  ]
  
  //Options
  var options = {
      path: coordinates,
      strokeColor: "#222",
      strokeOpacity: 1,
      strokeWeight: 2,
      fillColor: "#000",
      fillOpacity: 0,
      zIndex: 0
  }
  
  //Create polygon
  var polygon = new google.maps.Polygon( options );
  
  //Show it on map
  polygon.setMap( map );
  </code></pre>
  
  <p>I need to do my homework because live calculations are excluded for sure. I will probably need to do it the hard way but <strong>maybe some of you know some handy online tool which calculates bordering box based on inserted coords?</strong></p>
  
  <p>I need as simple as possible shape because I need to check if my polygon is in viewport and it would probably be a nightmare with 800 points because I don't know any other way besides looping through all the points.</p>