Clustering
Groups many items on a map based on zoom level.
Parameters
all items to show
a lambda invoked when the user clicks a cluster of items
a lambda invoked when the user clicks a non-clustered item
a lambda invoked when the user clicks the info window of a non-clustered item
a lambda invoked when the user long-clicks the info window of a non-clustered item
an optional Composable that is rendered for each Cluster.
an optional Composable that is rendered for each non-clustered item.
Groups many items on a map based on clusterManager.
Parameters
all items to show
a ClusterManager that can be used to specify the algorithm used by the rendering.
Deprecated
If clusterRenderer is specified, clusterContent and clusterItemContent are not used; use a function that takes ClusterManager as an argument instead.
Replace with
import com.google.maps.android.compose.clustering.Clustering
import androidx.compose.runtime.SideEffect
import com.google.maps.android.clustering.ClusterManager
val clusterManager = rememberClusterManager<T>()
LaunchedEffect(clusterManager, clusterRenderer) {
clusterManager?.renderer = clusterRenderer
}
SideEffect {
clusterManager ?: return@SideEffect
clusterManager.setOnClusterClickListener(onClusterClick)
clusterManager.setOnClusterItemClickListener(onClusterItemClick)
clusterManager.setOnClusterItemInfoWindowClickListener(onClusterItemInfoWindowClick)
clusterManager.setOnClusterItemInfoWindowLongClickListener(onClusterItemInfoWindowLongClick)
}
// Wait for renderer to apply before clustering
if (clusterManager != null && clusterManager.renderer == clusterRenderer) {
Clustering(
items = items,
clusterManager = clusterManager,
)
}
Groups many items on a map based on zoom level.
Parameters
all items to show
a lambda invoked when the user clicks a cluster of items
a lambda invoked when the user clicks a non-clustered item
a lambda invoked when the user clicks the info window of a non-clustered item
a lambda invoked when the user long-clicks the info window of a non-clustered item
an optional Composable that is rendered for each Cluster.
an optional Composable that is rendered for each non-clustered item.
an optional ClusterRenderer that can be used to specify the algorithm used by the rendering.