Companion

object Companion

Factory helpers mirroring Mapbox expression operators. Each method returns a new Expression node; nest them or wrap in StyleValue.Expression as needed.

Unless a factory says otherwise, GLES Feature-path evaluation does run the operator for fill/line/symbol/heatmap paint and for vector layer filters.

Properties

Link copied to clipboard
val geometryType: <Error class: unknown class>

["geometry-type"]. Serializes for Mapbox native layers; GLES Feature-path evaluation does not resolve this operator.

Link copied to clipboard
val mapTime: <Error class: unknown class>

Active map timeline position as Unix seconds (from the map controller), not wall clock. iOS/JS ["map-time"] parity. Used in vector filters; GLES applies it on the dedicated map-time reveal path rather than the generic paint evaluator.

Link copied to clipboard
val time: <Error class: unknown class>

Alias for mapTime — ["time"].

Link copied to clipboard
var zoom: <Error class: unknown class>

["zoom"] — current map zoom.

Functions

Link copied to clipboard
fun abs(value: Any): Expression

["abs", value].

Link copied to clipboard
fun add(lhs: Any, rhs: Any): Expression

["+", lhs, rhs].

Link copied to clipboard
fun and(expressions: List<Any>): Expression

["all", …expressions] — logical AND.

Link copied to clipboard
fun at(index: Int, array: Any): Expression

["at", index, array] — element at index.

Link copied to clipboard
fun bind(bindings: List<Expression.Variable>, output: Any): Expression

["let", name1, value1, …, output] — bind Variables then evaluate output. Pair with variable inside output. GLES evaluates let / var on the Feature path.

Link copied to clipboard
fun ceil(value: Any): Expression

["ceil", value].

Link copied to clipboard
fun coalesce(expressions: List<Any>): Expression

["coalesce", …expressions] — first non-null result.

Link copied to clipboard
fun concat(parts: List<Any>): Expression

["concat", …parts] — string concatenation (also used to prefix # on hex colors).

Link copied to clipboard
fun contains(value: Any, array: List<String>): Expression

Membership test serialized as ["match", value, item1, true, item2, true, …, false] (more widely supported as a Mapbox layer filter than ["in", …]). GLES evaluates match.

Link copied to clipboard
fun divide(lhs: Any, rhs: Any): Expression

["/", lhs, rhs].

Link copied to clipboard
fun downcase(input: Any): Expression

["downcase", input].

Link copied to clipboard
fun equals(lhs: Any, rhs: Any): Expression

["==", lhs, rhs].

Link copied to clipboard
fun floor(value: Any): Expression

["floor", value].

Link copied to clipboard

Mapbox ["format", text, options, …] for mixed-style labels. Serializes for Mapbox native symbol layers; GLES Feature-path evaluation does not run this operator.

Link copied to clipboard
fun get(property: String): Expression

["get", property] for a feature property. Dotted property (e.g. "vals.0") is expanded via getPath into nested get / at nodes.

Link copied to clipboard

Nested property access: "a.b" → ["get", "b", ["get", "a"]], and numeric segments such as "vals.0" become ["at", 0, ["get", "vals"]].

Link copied to clipboard
fun greaterThan(lhs: Any, rhs: Any): Expression

[">", lhs, rhs].

Link copied to clipboard

[">=", lhs, rhs].

Link copied to clipboard
fun has(property: String, obj: Any? = null): Expression

["has", property] on the feature, or ["has", property, obj] when obj is set. Dotted property is expanded via hasPath.

Link copied to clipboard
fun hasPath(property: String): Expression

Nested has: "a.b" → ["has", "b", ["get", "a"]].

Link copied to clipboard
fun indexOf(search: Any, array: Any): Expression

["index-of", search, array]. Serializes for Mapbox native layers; GLES Feature-path evaluation does not run this operator.

Link copied to clipboard
fun interpolate(input: Any, stops: List<Any>): Expression

Linear ["interpolate", ["linear"], input, …stops]. ColorStop entries expand to value + rgba(...) string. GLES evaluates linear interpolation for color and number paint.

fun interpolate(interpolation: Any, input: Any, stops: List<Any>): Expression

["interpolate", interpolation, input, …stops].

Link copied to clipboard
fun interpolateCubicBezier(input: Any, controlPoints: List<Double>, stops: List<Any>): Expression

["interpolate", ["cubic-bezier", x1, y1, x2, y2], input, …stops]. controlPoints must be four numbers. GLES evaluates cubic-bezier interpolation.

Link copied to clipboard
fun interpolateExponential(input: Any, base: Double, stops: List<Any>): Expression

["interpolate", ["exponential", base], input, …stops]. GLES evaluates exponential interpolation for color and number paint.

Link copied to clipboard
fun join(separator: String, parts: List<Any>): Expression

["join", separator, …parts].

Link copied to clipboard
fun length(input: Any): Expression

["length", input] — string or array length.

Link copied to clipboard
fun lessThan(lhs: Any, rhs: Any): Expression

["<", lhs, rhs].

Link copied to clipboard

["<=", lhs, rhs].

Link copied to clipboard
fun literal(value: Any): Expression

["literal", value] — wrap a Kotlin value as an expression operand.

Link copied to clipboard
fun match(input: Any, matches: List<Expression.Step<Any>>, fallback: Any?): Expression

["match", input, label, output, …, fallback]. Each Step.value is a match label and Step.result the output for that label.

Link copied to clipboard
fun max(vararg values: Any): Expression

["max", …values].

Link copied to clipboard
fun min(vararg values: Any): Expression

["min", …values].

Link copied to clipboard
fun mod(lhs: Any, rhs: Any): Expression

["%", lhs, rhs] (remainder).

Link copied to clipboard
fun multiply(lhs: Any, rhs: Any): Expression

["*", lhs, rhs].

Link copied to clipboard
fun not(expression: Any): Expression

["!", expression] — logical NOT.

Link copied to clipboard
fun notEquals(lhs: Any, rhs: Any): Expression

["!=", lhs, rhs].

Link copied to clipboard
fun or(expressions: List<Any>): Expression

["any", …expressions] — logical OR.

Link copied to clipboard
fun rgb(red: Any, green: Any, blue: Any): Expression

["rgb", red, green, blue] with channels in 0…255. GLES evaluates this for fill color.

Link copied to clipboard
fun rgba(red: Any, green: Any, blue: Any, alpha: Any): Expression

["rgba", red, green, blue, alpha] with RGB in 0…255 and alpha in 0…1. GLES evaluates this for fill color.

Link copied to clipboard
fun round(value: Any): Expression

["round", value].

Link copied to clipboard
fun slice(input: Any, start: Int, end: Int? = null): Expression

["slice", input, start] or ["slice", input, start, end].

Link copied to clipboard
fun <T : Any> step(input: Any, stops: List<Expression.Step<T>>): Expression

["step", input, output0, stop1, output1, …]. The first Step is the base output (its Step.value is ignored); later stops pair Step.value thresholds with outputs.

Link copied to clipboard
fun subtract(value: Any): Expression

Unary negate: ["-", 0, value].

fun subtract(lhs: Any, rhs: Any): Expression

["-", lhs, rhs].

Link copied to clipboard
fun switchCase(conditionsAndResults: List<Expression.Case>, fallback: Any): Expression

["case", cond1, out1, …, fallback] (Mapbox case; named switchCase to avoid the Kotlin keyword).

Link copied to clipboard
fun toBoolean(value: Any): Expression

["to-boolean", value]. Serializes for Mapbox native layers. GLES Feature-path evaluation does not run this operator except a narrow symbol-color path.

Link copied to clipboard
fun toNumber(value: Any): Expression

["to-number", value].

Link copied to clipboard
fun toString(value: Any): Expression

["to-string", value].

Link copied to clipboard
fun upcase(input: Any): Expression

["upcase", input].

Link copied to clipboard

["var", name] — reference a name bound by bind.