googlemaps / googlemaps/android-maps-compose

Clustering: Handling clusters in same location

Open
#275 3 comments 5 reactions 0 assignees View on GitHub
priority: p2 type: feature request
Dominant language
Kotlin
Stars
1.3k
Forks
181
Avg merge
2d 23h
Merged PRs (30d)
18

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.