android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

Clustering: Handling clusters in same location

Open barry-irvine opened this issue 2 years ago • 3 comments

Thank you very much for all your work on the library and the recent work on clustering.

I was having a play with the clustering library and wondered how we can handle pins when they're too close together.

E.g. in Bangkok I have the following 4 pins:

latitude=13.720681, longitude=100.515331 latitude=13.72066, longitude=100.515344 latitude=13.720681, longitude=100.515331 latitude=13.720681, longitude=100.515331

For the onClusterClick I have basically done this:

 cameraPositionState.animate(
                    CameraUpdateFactory.newLatLngZoom(
                        cluster.position,
                        cameraPositionState.position.zoom + 1))

But after a while it doesn't really do anything and after 20.0f zoom nothing changes. Are there some examples of how to explode these out once any further zoom will not expand the cluster? It would be nice if I could skip intermediate zoom levels that won't change the state of the cluster too, if I knew how to calculate whether a zoom would change the clustering.

Also does the zIndex actual work on the clusterItemContent? I tried doing this:

         Image(
                painterResource(drawable),
                contentDescription = item.title,
                Modifier.zIndex(if (isCurrent) 1f else 0f)
            )

but the pins never rearrange when one of them becomes current.

barry-irvine avatar Feb 22 '23 08:02 barry-irvine

If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.

@barry-irvine Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Feb 22 '23 08:02 wangela

I found some work-arounds for old non-compose clustering like Make Your own Cluster Rendering or change maxZoom. But it doesn't work for the compose version.

Psijic avatar Apr 21 '23 16:04 Psijic

i'm also missing the ability to set the zIndex of clusters and cluster items. Currently i have the problem that the clusters (and items) are overlayed by other markers where i need to define zIndex

cwsiteplan avatar Sep 05 '23 13:09 cwsiteplan