Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何从标记列表中获取gmap中的中心?_Javascript_Google Maps_Extjs - Fatal编程技术网

Javascript 如何从标记列表中获取gmap中的中心?

Javascript 如何从标记列表中获取gmap中的中心?,javascript,google-maps,extjs,Javascript,Google Maps,Extjs,如何将getCenter函数与从gmap3.0中拾取的标记列表一起使用 现在我正在尝试这种方法 Ext.each(myRecords, function (r) { if (...) { myArray.push(new google.maps.LatLng(r.get('Latitude'), r.get('Longitude'))); } }); 有没有一种简单的方法可以从该数组中获取最远的标记?如果我能做到这一点,我也许能够做到: var myLatLng = ... var bo

如何将getCenter函数与从gmap3.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();