switchCase

open fun switchCase(@NonNull @Size(min = 1) input: Array<Expression>): Expression

Selects the first output whose corresponding test condition evaluates to true.

For each case a condition and an output should be provided. The last parameter should provide the default output.

Example usage:


SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
    iconSize(
        switchCase(
            get(KEY_TO_BOOLEAN), literal(3.0f),
            get(KEY_TO_OTHER_BOOLEAN), literal(5.0f),
            literal(1.0f) // default value
        )
    )
);

Return

expression

Parameters

input

expression input

See also

<a href="https://maplibre.org/maplibre-style-spec/expressions/#case">Style specification</a>