title: Uncaught RangeError: Maximum call stack size exceeded Google maps when I try to set bounds
body: <p>I created a working google map that I am now trying to have auto zoom out so all the points fit. </p>
  
  <p>When I added:</p>
  
  <pre><code>var bounds = new google.maps.LatLngBounds();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>bounds.extend(point);
  map.fitBounds(bounds); 
  </code></pre>
  
  <p>I then get this error:</p>
  
  <pre><code>Uncaught RangeError: Maximum call stack size exceeded
  J.get
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  J.set
  (anonymous function)
  Ey.(anonymous function).zoomRange_changed
  Zf
  </code></pre>
  
  <p>All my code for creating the map is:</p>
  
  <pre><code>function load() {
        var map = new google.maps.Map(document.getElementById("map"), {
          center: new google.maps.LatLng(47.6145, -122.3418),
          zoom: 13,
          mapTypeId: 'roadmap'
        });
        var infoWindow = new google.maps.InfoWindow;
  
        // Change this depending on the name of your PHP file
        downloadUrl("getMapMarkers.php", function(data) {
          var bounds = new google.maps.LatLngBounds();
          var xml = data.responseXML;
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i &lt; markers.length; i++) {
            var name = markers[i].getAttribute("name");
  
            var type = markers[i].getAttribute("type");
            var point = new google.maps.LatLng(
                parseFloat(markers[i].getAttribute("lat")),
                parseFloat(markers[i].getAttribute("lng")));
            var html = "&lt;b&gt;" + name + "&lt;/b&gt; &lt;br/&gt;" ;
            var icon = customIcons[type] || {};
            var marker = new google.maps.Marker({
              map: map,
              position: point,
              icon: icon.icon,
              shadow: icon.shadow
            });
            bindInfoWindow(marker, map, infoWindow, html);
            bounds.extend(point);
            map.fitBounds(bounds);
          }
        });
  
  
      }
  </code></pre>