/mapview/addLayer

The module exports the addLayer method which is bound to the mapview.

Methods

(inner) addLayer(layers) → {array}

A single or an array of JSON layer can be added to the mapview with the addLayer method.

A default zIndex is assigned to layer without an implicit zIndex.

A structuredClone of the JSON layer will be merged into a clone of the locale.layer template to be decorated and assigned to the mapview [this] layers.

The mapview [this] to which the addLayer method is bound will be assigned to the layer object.

A layer with a valid format property will be decorated and added to the mapview.layers{} object.

Layer with a display flag will shown in the mapview.

A renderComplete event will be assigned to the Openlayers mapview.Map{}. This promise will resolve once after all layer to be shown in the addLayer method have completed their render.

Parameters:
NameTypeDescription
layersobject

A single JSON layer or an array of JSON layer to be added to the mapview.

Returns:

The array of decorated layers is returned.

Type: 
array