googlemaps / android-maps-compose

Jetpack Compose composables for the Maps SDK for Android
https://developers.google.com/maps/documentation/android-sdk/maps-compose
Apache License 2.0
1.16k stars 143 forks source link

Zoom Level control for Compose Clustering #582

Open mdostal opened 5 months ago

mdostal commented 5 months ago

Thanks for stopping by to let us know something could be better!


PLEASE READ

If you have a support contract with Google, please create an issue in the support console. This will ensure a timely response.

Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform support resources page.

If your bug or feature request is not related to this particular library, please visit the Google Maps Platform issue trackers.

Check for answers on StackOverflow with the google-maps tag.


Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

With clustering markers -- I am trying to tell it to not cluster based on zoom level. I see that custom renderer has quite a few more options, but I'm not seeing where I can actually do something like the shouldCluster from the Android Library. Maybe I'm missing something, but I'd love to know if there is a way to do this in the compose version. This seems to be valid in other libraries, but we have no way to set the zoom level for clustering on compose.

Describe the solution you'd like A clear and concise description of what you want to happen.

The easiest solution would be to have a zoom level variable for the cluster so that you can set clusters to only happen after a certain zoom. However, this could be more advanced and just have a pattern of overriding and dealing with the overall cluster management by enabling a number of overridden methods for clustering. Overall, it seems the other libraries have this more detailed or at least have a zoom level available.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

ability to override the shouldRenderAsCluster method or add in some logic. I do not want to cluster at the close zoom levels (I have lots of nearby markers) - I want to only cluster at a higher zoom. There may be some other things, I'm not thinking of yet, but an additional check in there that could be passed in or run may be helpful

I have considered overloading and rewriting most of the cluster controls from android as my own purely to change this one area. However, at this point, it almost makes more sense to branch, and use my own version of the compose library rather than maintaining the number of levels in the application. Either way, this would make my application prone to breaking with any update and would be a poor experience.

In the meantime, we will focus on other aspects to make things more viewable and easily used, but we still want to change the zoom level for the clustering controls.

Additional context Add any other context or screenshots about the feature request here.

This seems to exist in the JS, android, and other APIs in one form or fashion, so I would assume compose would want to at least maintain parity.

kikoso commented 5 months ago

Hi @mdostal ,

The clustering logic that would eventually govern this logic is in the android-maps-utils. More specifically, what we would need is to set a field like minZoomLevel, analogously to another field that we already have on the android-maps-utils, mMinClusterSize.

This is a change that could make sense. We would need to align releases from the android-maps-utils and android-maps-compose. On the latter, we would need to discuss how to expose it. Right now we have a rememberClusterManager function that could be a good candidate. This would need to be well reflected, since the renderer and/or the manager contain a large set of configurability and it would be hence a major change.

I would like also to see if this request gets any community support. Feel free to vote it if you would like to see it live.