【发布时间】:2012-04-20 00:56:08
【问题描述】:
我是 Maps API 的新手,我正在尝试在 Sencha Touch 中使用地图。
我在地图上成功绘制了一组标记。但我想缩放地图并将其居中以尽可能紧密地匹配所有标记。
当我调用 fitBounds 函数时,我得到了一个地图视图,其中我的所有标记都位于屏幕的左上角,并且缩放太宽 - 这不是我想要的。
关于如何以最接近的缩放比例在地图视图上获取我的所有标记的任何提示?谢谢!
function setCenter()
{
var bounds = new google.maps.LatLngBounds();
for (var i = 0, LtLgLen = LatLngList.length; i < LtLgLen; i++) {
// And increase the bounds to take this point
bounds.extend (LatLngList[i]);
}
map.getMap().fitBounds(bounds);
}
【问题讨论】:
-
能否提供截图,
fitBounds之后会有什么? -
我的回答有帮助吗?需要更多帮助吗?
-
感谢您的回复 - 我尝试了您的建议,但地图仍然将所有标记放在左上角的视线之外。
标签: google-maps google-maps-api-3