google-maps-ios-utils icon indicating copy to clipboard operation
google-maps-ios-utils copied to clipboard

No clustering for less than 4 markers

Open pabloelizalde opened this issue 10 years ago • 4 comments

I experienced that I need to have at least 4 markers for the clustering to be performed. When I have 3 markers, there is no clustering, no matter in which zoom level I am.

screenshot 2016-07-20 13 14 07

Is there something I am missing? Thanks

pabloelizalde avatar Jul 20 '16 11:07 pabloelizalde

That's the default behavior of the GMUDefaultClusterRenderer class

  • (BOOL)shouldRenderAsCluster:(id)cluster atZoom:(float)zoom { return cluster.count >= kGMUMinClusterSize && zoom <= kGMUMaxClusterZoom; } kGMUMinClusterSize is 4.

What you can do is create a custom renderer which derives from GMUDefaultClusterRenderer and override that method to your own liking (for example removing the cluster.count >= kGMUMinClusterSize clause).

mountainvat avatar Jul 20 '16 13:07 mountainvat

Great! Thanks for the quick response 👍

pabloelizalde avatar Jul 20 '16 13:07 pabloelizalde

i want to know how i create custom marker in a cluster plz help me

rajatvns avatar Aug 08 '16 14:08 rajatvns

@rajatvns Can you please open a new ticket and describe in detail what you are trying to achieve?

Some pointers without know exactly what you need: If you wanted to customize the individual cluster item marker, please see this https://github.com/googlemaps/google-maps-ios-utils/issues/21

If you wanted to customize the cluster marker, you can use the default GMUDefaultClusterIconGenerator or extends the GMUDefaultClusterRenderer.

mountainvat avatar Aug 09 '16 01:08 mountainvat