Expression

data class Expression(val raw: Any)

Mapbox style expression wrapper: a JSON-serializable tree (usually a List whose first element is the operator) compatible with the Mapbox expression spec.

Use the companion factories (get, interpolate, match, …) and wrap the result in StyleValue.Expression for data-driven paint, or assign the expression to com.xweather.mapsgl.layers.spec.VectorLayerDescriptor.filter.

Where expressions run

  • Mapbox native style layers evaluate the serialized JSON (full Mapbox operator set).

  • MapsGL GLES vector layers (useGlRendering = true) evaluate a documented subset on the Feature path for paint and layer filters. Unknown operators fail closed (no color / feature dropped) and may fall back from a narrower circle fast-path to the Feature evaluator.

  • zoom is an input for GLES paint evaluation, not for filters.

  • mapTime / time are handled by the map-time filter/reveal path, not the generic paint evaluator.

Operators that GLES does not evaluate still serialize correctly for Mapbox native layers: format, indexOf, toBoolean, interpolate-hcl / interpolate-lab, trig/logs, geometryType.

See also

Constructors

Link copied to clipboard
constructor(raw: Any)

Types

Link copied to clipboard
data class Case(val condition: Expression, val result: Any?)

One branch in a case expression: boolean condition and result when true.

Link copied to clipboard
object Companion

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

Link copied to clipboard
data class Step<T>(val value: T?, val result: Any)

One stop in step (or similar) expressions: input threshold value and result output.

Link copied to clipboard
data class Variable(val key: String, val value: Any)

Binding for let: key name and value bound expression or literal.

Properties

Link copied to clipboard
val raw: Any

Underlying value passed to makeJSONObject for style JSON or debugging.

Functions

Link copied to clipboard

JSON form of raw (rgba(...) strings, nested lists, etc.).