OpenLayers layer. When the layer has a source configured,
it will be modified to use the configuration from the glStyle's source. Options specified on the
layer's source will override those from the glStyle's source, except for url and
tileUrlFunction. When the source projection is the default (EPSG:3857), the tileGrid will
also be overridden. If you'd rather not have ol-mapbox-style modify the source, configure applyStyle()
with the updateSource: false option.
Mapbox/MapLibre Style object.
OptionalsourceOrLayersOrOptions: string | string[] | Options & ApplyStyleOptions = ''Options or
source key or an array of layer ids from the Mapbox/MapLibre Style object. When a source key is
provided, all layers for the specified source will be included in the style function. When layer
ids are provided, they must be from layers that use the same source. When not provided or a falsey
value, all layers using the same source as the first layer matching the provided layer type will be rendered.
OptionaloptionsOrPath: string | Options & ApplyStyleOptions = {}Deprecated. Options. Alternatively the path of the style file
(only required when a relative path is used for the "sprite" property of the style).
Optionalresolutions: number[] = undefinedDeprecated. Resolutions for mapping resolution to zoom level. Only needed when working with non-standard tile grids or projections, can also be supplied with options.
Promise which will be resolved when the style can be used for rendering.
Applies a style function to an
ol/layer/VectorTileorol/layer/Vectorwith anol/source/VectorTileor anol/source/Vector. If the layer does not have a source yet, it will be created and populated from the information in theglStyle(unlessupdateSourceis set tofalse).Example:
The style function will render all layers from the
glStyleobject that use the source of the first layer, the specifiedsource, or a subset of layers from the same source. The source needs to be a"type": "vector"or"type": "geojson"source.Two additional properties will be set on the provided layer:
mapbox-source: Theidof the Mapbox/MapLibre Style document's source that the OpenLayers layer was created from. Usuallyapply()creates one OpenLayers layer per Mapbox/MapLibre Style source, unless the layer stack has layers from different sources in between.mapbox-layers: Theids of the Mapbox/MapLibre Style document's layers that are included in the OpenLayers layer.