ClusterOptions

data class ClusterOptions @JvmOverloads constructor(cluster: Boolean, clusterRadius: Long, circleRadiusExpression: Value?, circleRadius: Double, textColorExpression: Value?, textColor: Int, textSizeExpression: Value?, textSize: Double, textField: Value?, clusterMaxZoom: Long, colorLevels: List<Pair<Int, Int>>, clusterProperties: HashMap<String, Any>?)

Options to show and configure symbol clustering with using SymbolManager.

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

Constructors

ClusterOptions
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, colorLevels: List<Pair<Int, Int>> = listOf(Pair(0, Color.BLUE)), clusterProperties: HashMap<String, Any>? = null)

Properties

circleRadius
Link copied to clipboard
val circleRadius: Double = 18.0

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

circleRadiusExpression
Link copied to clipboard
val circleRadiusExpression: Value? = null

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

cluster
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:

clusterMaxZoom
Link copied to clipboard
val clusterMaxZoom: Long = 14

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.

clusterProperties
Link copied to clipboard
val clusterProperties: HashMap<String, Any>? = null

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.

clusterRadius
Link copied to clipboard
val clusterRadius: Long = 50

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.

colorLevels
Link copied to clipboard
val colorLevels: List<Pair<Int, Int>>

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

textColor
Link copied to clipboard
val textColor: Int

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

textColorExpression
Link copied to clipboard
val textColorExpression: Value? = null

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

textField
Link copied to clipboard
val textField: Value? = null

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

textSize
Link copied to clipboard
val textSize: Double = 12.0

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

textSizeExpression
Link copied to clipboard
val textSizeExpression: Value? = null

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