For layer sources that provide pre-rendered, tiled images in grids that are
organized by zoom levels for specific resolutions.
Note that any property set in the options is set as a
BaseObject
property on the layer object; for example, setting
title: 'My Title'
in the
options means that
title
is observable, and has get/set accessors.
The z-index for layer rendering. At rendering time, the layers
will be ordered, first by Z-index and then by position. When
undefined
, a
zIndex
of 0 is assumed
for layers that are added to the map's
layers
collection, or
Infinity
when the layer's
setMap()
method was used.
Array
of sources for this layer. Takes precedence over
source
. Can either be an array of sources, or a function that
expects an extent and a resolution (in view projection units per pixel) and returns an array of sources. See
sourcesFromTileGrid
for a helper function to generate sources that are organized in a
pyramid following the same pattern as a tile grid.
Note:
All sources must have the same band count and content.
Sets the layer as overlay on a map. The map will not manage
this layer in its layers collection, and the layer will be rendered on top. This is useful for
temporary layers. The standard way to add a layer to a map and have it managed by the map is to
use
addLayer
.
Triggered after layers are composed. When dispatched by the map, the event object will not have
a context set. When dispatched by a layer, the event object will have a context set. Only
WebGL layers currently dispatch this event.
Triggered before layers are composed. When dispatched by the map, the event object will not have
a context set. When dispatched by a layer, the event object will have a context set. Only
WebGL layers currently dispatch this event.
Triggered when rendering is complete, i.e. all sources and tiles have
finished loading for the current viewport, and all tiles are faded in.
The event object will not have a context set.
Dispatches an event and calls all listeners listening for events
of this type. The event parameter can either be a string or an
Object with a
type
property.
Get data for a pixel location. The return type depends on the source data. For image tiles,
a four element RGBA array will be returned. For data tiles, the array length will match the
number of bands in the dataset. For requests outside the layer extent,
null
will be returned.
Data for a image tiles can only be retrieved if the source's
crossOrigin
property is set.
// display layer data on every pointer move
map.on('pointermove', (event) => {
console.log(layer.getData(event.pixel));
The layer is visible on the map view, i.e. within its min/max resolution or zoom and
extent, not set to visible: false
, and not inside a layer group that is set
to visible: false
.
Returns:
Unique key for the listener. If
called with an array of event types as the first argument, the return
will be an array of keys.
Returns:
Unique key for the listener. If
called with an array of event types as the first argument, the return
will be an array of keys.
Sets the layer to be rendered on top of other layers on a map. The map will
not manage this layer in its layers collection. This
is useful for temporary layers. To remove an unmanaged layer from the map,
use #setMap(null)
.
To add the layer to a map and have it managed by the map, use
addLayer
instead.
Set the maximum zoom (exclusive) at which the layer is visible.
Note that the zoom levels for layer visibility are based on the
view zoom level, which may be different from a tile source zoom level.
Set the minimum zoom (inclusive) at which the layer is visible.
Note that the zoom levels for layer visibility are based on the
view zoom level, which may be different from a tile source zoom level.