我创建了一个有效的谷歌地图,我现在正在尝试自动缩小,以便所有点都适合。
当我添加:
var bounds = new google.maps.LatLngBounds();
和
bounds.extend(point);
map.fitBounds(bounds);
然后我得到这个错误:
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
我创建地图的所有代码都是:
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);
}
});
}