Google Maps Api v3 - 新的 MarkerClusterer 运行速度太慢?

发布于 2024-10-09 08:07:36 字数 289 浏览 0 评论 0原文

为了创建地图聚类器,我使用:

markerClustererGPC = new MarkerClusterer(myMap.map, markersGPC, GPCOptions);

但有时它不起作用,并且markerClustererGPC有时未定义。

我搜索这个问题,并意识到(看起来)服务器有时太快,并且因此未定义集群。

如果服务器有点旧(慢),它可以正常工作。

我的说法正确吗?我该怎么做才能避免这个问题,使我的代码适合在任何服务器上工作?

to create map clusterer, i use:

markerClustererGPC = new MarkerClusterer(myMap.map, markersGPC, GPCOptions);

but sometimes it does not works, and markerClustererGPC is sometimes undefined.

i search on this problem, and realise that (it looks like) server is sometimes too fast, and cluster is not defined due to that.

if server is a bit older (slower), it works without problems.

am i right about this? what can i do to avoid this problem, to make my code proper to work on any server?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔少女心 2024-10-16 08:07:36

我认为因为谷歌地图未加载完成,所以你的地图无法识别。
尝试添加这个:

var isLoad = false;

google.maps.event.addListener(地图,'tilesloaded',
函数(){

如果(!isLoad){

isLoad = true;
LoadClusterFunction();   

}

});

在您调用创建地图后(地图对于谷歌地图是可变的)

i think because google map is not loaded completed so your map is unidentified.
Try add this:

var isLoad = false;

google.maps.event.addListener(map,'tilesloaded',
function () {

if (!isLoad) {

isLoad = true;
LoadClusterFunction();   

}

});

after your call for creating map (map is variable for google map)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文