Skip to content

createLegendFromLayer() ​

createLegendFromLayer(layer, options?): Promise<HTMLElement | null>

Creates a legend from a layer.

Parameters ​

ParameterTypeDescription
layerMapContextLayerThe layer to create the legend from.
options?LegendOptionsThe options to create the legend.

Returns ​

Promise<HTMLElement | null>

A promise that resolves to the legend element or null if the legend could not be created.