OpenLayers v4.0.1 API - Namespace: layer

# Namespace: layer

This documentation is for OpenLayers v4.0.1. The latest is v.

## olx.layer

### Type Definitions

#### olx.layer.BaseOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `opacity` | number | undefined | <optional> | Opacity (0, 1). Default is `1`.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true`.
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `zIndex` | number | undefined | <optional> | The z-index for layer rendering. At rendering time, the layers will be ordered, first by Z-index and then by position. The default Z-index is 0.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.

#### olx.layer.GroupOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `opacity` | number | undefined | <optional> | Opacity (0, 1). Default is `1`.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true`.
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `zIndex` | number | undefined | <optional> | The z-index for layer rendering. At rendering time, the layers will be ordered, first by Z-index and then by position. The default Z-index is 0.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.
  `layers` | Array.<ol.layer.Base> | ol.Collection.<ol.layer.Base> | undefined | <optional> | Child layers.

#### olx.layer.HeatmapOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `gradient` | Array.<string> | undefined | <optional> | The color gradient of the heatmap, specified as an array of CSS color strings. Default is `['#00f', '#0ff', '#0f0', '#ff0', '#f00']`.
  `radius` | number | undefined | <optional> | Radius size in pixels. Default is `8`.
  `blur` | number | undefined | <optional> | Blur size in pixels. Default is `15`.
  `shadow` | number | undefined | <optional> | Shadow size in pixels. Default is `250`.
  `weight` | string | function |  | The feature attribute to use for the weight or a function that returns a weight from a feature. Weight values should range from 0 to 1 (and values outside will be clamped to that range). Default is `weight`. Required.
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.
  `opacity` | number | undefined | <optional> | Opacity. 0-1. Default is `1`.
  `source` | ol.source.Vector |  | Source. Required.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true` (visible).

#### olx.layer.ImageOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `opacity` | number | undefined | <optional> | Opacity (0, 1). Default is `1`.
  `source` | ol.source.Image |  | Source for this layer. Required.
  `map` | ol.Map | undefined | <optional> | 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 `ol.Map#addLayer`.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true` (visible).
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.

#### olx.layer.LayerOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `opacity` | number | undefined | <optional> | Opacity (0, 1). Default is `1`.
  `source` | ol.source.Source | undefined | <optional> | Source for this layer. If not provided to the constructor, the source can be set by calling `layer.setSource(source)` after construction.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true` (visible).
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `zIndex` | number | undefined | <optional> | The z-index for layer rendering. At rendering time, the layers will be ordered, first by Z-index and then by position. The default Z-index is 0.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.

#### olx.layer.TileOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `opacity` | number | undefined | <optional> | Opacity (0, 1). Default is `1`.
  `preload` | number | undefined | <optional> | Preload. Load low-resolution tiles up to `preload` levels. By default `preload` is `0`, which means no preloading.
  `source` | ol.source.Tile |  | Source for this layer. Required.
  `map` | ol.Map | undefined | <optional> | 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 `ol.Map#addLayer`.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true` (visible).
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.
  `useInterimTilesOnError` | boolean | undefined | <optional> | Use interim tiles on error. Default is `true`.

#### olx.layer.VectorOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `renderOrder` | function |  | Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use `null` to avoid the sort, but get an undefined draw order. Required.
  `map` | ol.Map | undefined | <optional> | 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 `ol.Map#addLayer`.
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.
  `opacity` | number | undefined | <optional> | Opacity. 0-1. Default is `1`.
  `renderBuffer` | number | undefined | <optional> | The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width or label. Default is 100 pixels.
  `source` | ol.source.Vector |  | Source. Required.
  `style` | ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined | <optional> | Layer style. See `ol.style` for default style which will be used if this is not defined.
  `updateWhileAnimating` | boolean | undefined | <optional> | When set to `true`, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to `false`, batches will be recreated when no animation is active. Default is `false`.
  `updateWhileInteracting` | boolean | undefined | <optional> | When set to `true`, feature batches will be recreated during interactions. See also `updateWhileAnimating`. Default is `false`.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true` (visible).

#### olx.layer.VectorTileOptions{Object}

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `renderBuffer` | number | undefined | <optional> | The buffer around the tile extent used by the renderer when getting features from the vector tile for the rendering or hit-detection. Recommended value: Vector tiles are usually generated with a buffer, so this value should match the largest possible buffer of the used tiles. It should be at least the size of the largest point symbol or line width. Default is 100 pixels.

  `renderMode`

  ol.layer.VectorTileRenderType | string | undefined

  <optional>

  Render mode for vector tiles:

  - `'image'`: Vector tiles are rendered as images. Great performance, but point symbols and texts are always rotated with the view and pixels are scaled during zoom animations.
  - `'hybrid'`: Polygon and line elements are rendered as images, so pixels are scaled during zoom animations. Point symbols and texts are accurately rendered as vectors and can stay upright on rotated views.
  - `'vector'`: Vector tiles are rendered as vectors. Most accurate rendering even during animations, but slower performance than the other options.

  The default is `'hybrid'`.

  `renderOrder` | function |  | Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Required.
  `map` | ol.Map | undefined | <optional> | 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 `ol.Map#addLayer`.
  `extent` | ol.Extent | undefined | <optional> | The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
  `minResolution` | number | undefined | <optional> | The minimum resolution (inclusive) at which this layer will be visible.
  `maxResolution` | number | undefined | <optional> | The maximum resolution (exclusive) below which this layer will be visible.
  `opacity` | number | undefined | <optional> | Opacity. 0-1. Default is `1`.
  `preload` | number | undefined | <optional> | Preload. Load low-resolution tiles up to `preload` levels. By default `preload` is `0`, which means no preloading.
  `source` | ol.source.VectorTile | undefined | <optional> | Source.
  `style` | ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined | <optional> | Layer style. See `ol.style` for default style which will be used if this is not defined.
  `updateWhileAnimating` | boolean | undefined | <optional> | When set to `true`, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to `false`, batches will be recreated when no animation is active. Default is `false`.
  `updateWhileInteracting` | boolean | undefined | <optional> | When set to `true`, feature batches will be recreated during interactions. See also `updateWhileAnimating`. Default is `false`.
  `visible` | boolean | undefined | <optional> | Visibility. Default is `true` (visible).