MarkerClusterer - 关联数组 [英] MarkerClusterer - associated array

查看:145
本文介绍了MarkerClusterer - 关联数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MarkerClusterer可以很好地处理数值数组,但是您是否尝试过将它与标记对象一起使用?我的意思是关联数组,因为我将这些数组中的所有标记保留下来。只有我想到的是将相关数组转换为不寻常数组,但这个解决方案看起来很奇怪。我意识到这可能是不可能的,但也许有人有解决它的办法。

解决方案

您可以将标记数组添加到MarkerClusterer中,也可以单独添加它们(它们不会在一个数组中)。您可以在创建MarkerClusterer时将您的标记添加到MarkerClusterer中,并将它们添加到您的关联数组/对象中。 文档中的addMarker方法


MarkerClusterer works well with numeric array, but have you tried to use it with object of markers? I mean associated array, because I keep all markers inside this kind of array. Only what comes to my mind is translate associated array to "unusual" array, but this solution looks like strange. I aware that probably is not possible, but maybe someone has workaround for it.

解决方案

You can add an array of markers to the MarkerClusterer, or you can add them individually (they don't have to be in an array). Add your markers to the MarkerClusterer as you create them and add them to your "associative" array/object.

See the addMarker method in the documentation

这篇关于MarkerClusterer - 关联数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆