ClusterOptions

data class ClusterOptions @JvmOverloads constructor(val cluster: Boolean = true, val clusterRadius: Long = 50, val circleRadiusExpression: Value? = null, val circleRadius: Double = 18.0, val textColorExpression: Value? = null, val textColor: Int = Color.WHITE, val textSizeExpression: Value? = null, val textSize: Double = 12.0, val textField: Value? = null, val clusterMaxZoom: Long = 14, val clusterMinPoints: Long = 2, val colorLevels: List<Pair<Int, Int>> = listOf(Pair(0, Color.BLUE)), val clusterProperties: HashMap<String, Any>? = null)

Options to show and configure symbol clustering with using PointAnnotationManager or CircleAnnotationManager.

It exposes a minimal of configuration options, a more advanced setup can be created manually with using CircleLayer and SymbolLayers directly.

Constructors

Link copied to clipboard
fun ClusterOptions(cluster: Boolean = true, clusterRadius: Long = 50, circleRadiusExpression: Value? = null, circleRadius: Double = 18.0, textColorExpression: Value? = null, textColor: Int = Color.WHITE, textSizeExpression: Value? = null, textSize: Double = 12.0, textField: Value? = null, clusterMaxZoom: Long = 14, clusterMinPoints: Long = 2, colorLevels: List<Pair<Int, Int>> = listOf(Pair(0, Color.BLUE)), clusterProperties: HashMap<String, Any>? = null)

Properties

Link copied to clipboard
val circleRadius: Double = 18.0

The circle radius of the cluster items in expression, literal(18) by default

Link copied to clipboard

The circle radius of the cluster items in expression. Have higher priority than circleRadius, but will apply circleRadius if not set any value.

Link copied to clipboard
val cluster: Boolean = true

If the data is a collection of point features, setting this to true clusters the points by radius into groups. Cluster groups become new Point features in the source with additional properties:

Link copied to clipboard

Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15.

Link copied to clipboard

Minimum number of points necessary to form a cluster if clustering is enabled. literal(2) by default.

Link copied to clipboard

An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form {"property_name": [operator, map_expression]}. operator is any expression function that accepts at least 2 operands (e.g. "+" or "max") — it accumulates the property value from clusters/points the cluster contains; map_expression produces the value of a single point.

Link copied to clipboard

Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile, 50 by default.

Link copied to clipboard

The cluster color levels, which a pair constructed with amount of point and a int color value.

Link copied to clipboard

The text color of cluster item in expression. color(Color.WHITE) by default

Link copied to clipboard

The text color of cluster item in expression. Have higher priority than textColor, but will apply textColor if not set any value.

Link copied to clipboard
val textField: Value? = null

The text field of a cluster item in expression. get("point_count") by default.

Link copied to clipboard
val textSize: Double = 12.0

The text size of cluster item in expression. literal(12) by default.

Link copied to clipboard

The text size of cluster item in expression. Have higher priority thantextSize, but will apply textSize if not set any value.