ClusterOptions

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.

data class ClusterOptions(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>?)

Constructors

ClusterOptions
Link copied to clipboard
fun ClusterOptions(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>?)

Functions

component1
Link copied to clipboard
operator fun component1(): Boolean
component10
Link copied to clipboard
operator fun component10(): Long
component11
Link copied to clipboard
operator fun component11(): List<Pair<Int, Int>>
component12
Link copied to clipboard
operator fun component12(): HashMap<String, Any>?
component2
Link copied to clipboard
operator fun component2(): Long
component3
Link copied to clipboard
operator fun component3(): Value?
component4
Link copied to clipboard
operator fun component4(): Double
component5
Link copied to clipboard
operator fun component5(): Value?
component6
Link copied to clipboard
operator fun component6(): Int
component7
Link copied to clipboard
operator fun component7(): Value?
component8
Link copied to clipboard
operator fun component8(): Double
component9
Link copied to clipboard
operator fun component9(): Value?
copy
Link copied to clipboard
fun copy(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>?): ClusterOptions
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
toString
Link copied to clipboard
open override fun toString(): String

Properties

circleRadius
Link copied to clipboard

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

val circleRadius: Double
circleRadiusExpression
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.

val circleRadiusExpression: Value?
cluster
Link copied to clipboard

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:

  • cluster Is true if the point is a cluster

  • cluster_id A unqiue id for the cluster to be used in conjunction with the cluster inspection methods

  • point_count Number of original points grouped into this cluster

  • point_count_abbreviated An abbreviated point count

val cluster: Boolean
clusterMaxZoom
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.

val clusterMaxZoom: Long
clusterProperties
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.

Example: {"sum": ["+", ["get", "scalerank"]]}.

For more advanced use cases, in place of operator, you can use a custom reduce expression that references a special ["accumulated"] value, e.g.: {"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}

val clusterProperties: HashMap<String, Any>?
clusterRadius
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.

val clusterRadius: Long
colorLevels
Link copied to clipboard

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

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

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

val textColor: Int
textColorExpression
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.

val textColorExpression: Value?
textField
Link copied to clipboard

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

val textField: Value?
textSize
Link copied to clipboard

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

val textSize: Double
textSizeExpression
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.

val textSizeExpression: Value?