Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught RangeError: Maximum call stack size exceeded Google maps when I try to set bounds

Tags:

google-maps

I created a working google map that I am now trying to have auto zoom out so all the points fit.

When I added:

var bounds = new google.maps.LatLngBounds(); 

and

bounds.extend(point); map.fitBounds(bounds);  

I then get this error:

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 

All my code for creating the map is:

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 < 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 = "<b>" + name + "</b> <br/>" ;           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);         }       });       } 
like image 644
Mike Avatar asked Mar 27 '13 23:03

Mike


1 Answers

I've just run into the same exception, it turned out to be that the longitude passed into "new google.maps.LatLng" was undefined.

like image 136
Ollie Buck Avatar answered Sep 22 '22 11:09

Ollie Buck