diff --git a/externs/olx.js b/externs/olx.js index cbba3e2ae3..9700718064 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -226,7 +226,10 @@ olx.MapOptions.prototype.keyboardEventTarget; /** - * Layers. If this is not defined, a map with no layers will be rendered. + * Layers. If this is not defined, a map with no layers will be rendered. Note + * that layers are rendered in the order supplied, so if you want, for example, + * a vector layer to appear on top of a tile layer, it must come after the tile + * layer. * @type {Array.|ol.Collection.|undefined} * @api stable */ diff --git a/src/ol/map.js b/src/ol/map.js index ebd33d7a5e..1a3a47a991 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -151,6 +151,15 @@ ol.MapProperty = { * a further element within the viewport, either DOM or Canvas, depending on the * renderer. * + * Layers are stored as a `ol.Collection` in layerGroups. A top-level group is + * provided by the library. This is what is accessed by `getLayerGroup` and + * `setLayerGroup`. Layers entered in the options are added to this group, and + * `addLayer` and `removeLayer` change the layer collection in the group. + * `getLayers` is a convenience function for `getLayerGroup().getLayers()`. + * Note that `ol.layer.Group` is a subclass of `ol.layer.Base`, so layers + * entered in the options or added with `addLayer` can be groups, which can + * contain further groups, and so on. + * * @constructor * @extends {ol.Object} * @param {olx.MapOptions} options Map options.