Creating Google Maps Clusters by type

自古美人都是妖i 提交于 2020-01-14 04:44:26

问题


I would like to know if it is possible to cluster markets on Google Maps not only by density or number, but also by type.

For example: I have 20 markers of type A and 50 of type B. Could I have a two different clusters, one grouping all the type A markers and another one with type B markers. Obviously with different icons.

Another possible solution would be a single cluster that its icon would change depending of the number of markers of type.

For example: if we have 20 markers type A and 50 type B, the cluster would be a B-Type image.

Any of this options can be possible? Thanks a lot.


回答1:


Yes, you can have a different MarkerClusterer for different types of markers. My map has seven different MarkerClusterer instances (I actually use: MarkerClustererPlus) managing different marker types, with different icons as you describe.

You could achieve your second option, but it would be some messy code with constant checking, re-checking, and setting of MarkerClusterer options. I strongly recommend the first option.




回答2:


hope this may help you-

Google Maps Server-side Clustering with Asp.net



来源:https://stackoverflow.com/questions/9669295/creating-google-maps-clusters-by-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!