如何将 getCenter() 函数与从 gmap(3.0) 中选取的标记列表一起使用?
现在我正在尝试这种方法
Ext.each(myRecords, function (r) {
if (...) {
myArray.push(new google.maps.LatLng(r.get('Latitude'), r.get('Longitude')));
}
});
有没有一种简单的方法可以获取距该数组最远的标记?如果我能做到这一点,我也许能够做到:
var myLatLng = ...
var bounds = new google.maps.LatLngBounds();
bounds.extend(myLatLng);
bounds.getCenter();
最佳答案
我不确定你到底想要什么。但要回答您在标题中提出的问题:
var bounds = new google.maps.LatLngBounds();
Ext.each(myMarkers, function (m) {
bounds.extend(m.getPosition());
});
bounds.getCenter();
关于javascript - 如何从标记列表中获取 gmap 的中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8656985/