Skip to content

hasLegendSupport() ​

hasLegendSupport(layer): layer is MapContextLayerWms | MapContextLayerWmts

Whether a layer type can carry a legend.

This is a cheap, type-level check; it does not guarantee that a legend actually exists (a WMTS layer may declare no legend URL). Use it to gate UI, and use the result of createLegendFromLayer to know whether a graphic is available.

Parameters ​

ParameterTypeDescription
layerMapContextLayerThe layer to check.

Returns ​

layer is MapContextLayerWms | MapContextLayerWmts

true if the layer is a WMS or WMTS layer.