问题
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