match
Selects the output whose label value matches the input value, or the fallback value if no match is found. The `input` can be any string or number expression. Each label can either be a single literal value or an array of values. If types of the input and keys don't match, or the input value doesn't exist, the expresion will fail without falling back to the default value.
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textColor(
match(get("keyToValue"),
literal(1), rgba(255, 0, 0, 1.0f),
literal(2), rgba(0, 0, 255.0f, 1.0f),
rgba(0.0f, 255.0f, 0.0f, 1.0f)
)
)
);
Return
expression
Parameters
expression input
See also
Selects the output whose label value matches the input value, or the fallback value if no match is found. The `input` can be any string or number expression. Each label can either be a single literal value or an array of values. If types of the input and keys don't match, or the input value doesn't exist, the expresion will fail without falling back to the default value.
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textColor(
match(get("keyToValue"), rgba(0.0f, 255.0f, 0.0f, 1.0f),
stop(1f, rgba(255, 0, 0, 1.0f)),
stop(2f, rgba(0, 0, 255.0f, 1.0f))
)
)
);
Return
expression
Parameters
expression input