image
Returns image expression for use in '*-pattern' and 'icon-image' layer properties. Compared to string literals that can be used to represent an image, image expression allows to determine an image's availability at runtime, thus, can be used in conditional coalesce operator.
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
iconImage(image(get("key-to-feature")))
);
Content copied to clipboard
Example usage with coalesce operator:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
iconImage(
coalesce(
image(literal("maki-11")),
image(literal("bicycle-15")),
image(literal("default-icon"))
)
)
);
Content copied to clipboard
Return
expression
Parameters
input
expression input
See also
<a href="https://docs. mapbox. com/mapbox-gl-js/style-spec/#expressions-types-image">Image expression</a>