### Hierarchy

- LayerHelper

## Index

### Properties

- $http_
- $q_
- tilesPreloadingLimit_

### Methods

- copyProperties
- createBasicGroup
- createBasicVectorTilesLayer
- createBasicWMSLayer
- createBasicWMSLayerFromDataSource
- createWMTSLayerFromCapabilitites
- createWMTSLayerFromCapabilititesObj
- fixResolution_
- getFlatLayers
- getFlatLayers_
- getGroupFromMap
- getLayerByName
- getQuerySourceIds
- getWMSLegendURL
- getWMTSLegendURL
- isLayerVisible
- refreshWMSLayer
- setZIndexToFirstLevelChildren
- updateWMSLayerState

## Properties

### $http_

$http_: IHttpService

- Defined in src/map/LayerHelper.js:64

### $q_

$q_: IQService

- Defined in src/map/LayerHelper.js:59

### tilesPreloadingLimit_

tilesPreloadingLimit_: number

- Defined in src/map/LayerHelper.js:71

The Tiles Preloading Limit value

## Methods

### copyProperties

- copyProperties(layerFrom: Layer<Source, any>, layerTo: Layer<Source, any>, opt_excludes: string[]): void

- - Defined in src/map/LayerHelper.js:115

  Copy each properties from a layer onto an other layer, with the option to exclude specific ones.

  #### Parameters

  - ##### layerFrom: Layer<Source, any>

    The layer from which to copy the properties.

  - ##### layerTo: Layer<Source, any>

    The layer onto which the properties are copied.

  - ##### opt_excludes: string[]

  #### Returns void

### createBasicGroup

- createBasicGroup(opt_layers: Collection<BaseLayer>): LayerGroup

- - Defined in src/map/LayerHelper.js:412

  Create and return an ol.layer.Group. You can pass a collection of layers to directly add them in the returned group.

  #### Parameters

  - ##### opt_layers: Collection<BaseLayer>

  #### Returns LayerGroup

  Layer group.

### createBasicVectorTilesLayer

- createBasicVectorTilesLayer(url: string, style: string | Object, layername: string, projection: string, tileGrid: TileGrid, opt_minResolution: number, opt_maxResolution: number, opt_opacity: number): any

- - Defined in src/map/LayerHelper.js:372

  #### Parameters

  - ##### url: string

    URL template. Must include {x}, {y} or {-y}, and {z} placeholders. A {?-?} template pattern, for example subdomain{a-f}.domain.com, may be used instead. of defining each one separately in the urls option.

  - ##### style: string | Object

    a Mapbox Style object.

  - ##### layername: string

    the name of the url as identified in the style.

  - ##### projection: string

    The projection code.

  - ##### tileGrid: TileGrid

    The tile grid to define the source with.

  - ##### opt_minResolution: number

  - ##### opt_maxResolution: number

  - ##### opt_opacity: number

  #### Returns any

  Vector tile layer.

### createBasicWMSLayer

- createBasicWMSLayer(sourceURL: string, sourceLayersName: string, sourceFormat: string, opt_serverType: string, opt_time: string, opt_params: Object, opt_crossOrigin: string, opt_customSourceOptions: unknown, opt_customLayerOptions: unknown): ImageLayer<ImageSource>

- - Defined in src/map/LayerHelper.js:147

  Create and return a basic WMS layer with only a source URL and a comma separated layers names (see {@link import('ol/source/ImageWMS').default}).

  #### Parameters

  - ##### sourceURL: string

    The source URL.

  - ##### sourceLayersName: string

    A comma separated names string.

  - ##### sourceFormat: string

    Image format, for example 'image/png'.

  - ##### opt_serverType: string

  - ##### opt_time: string

  - ##### opt_params: Object

  - ##### opt_crossOrigin: string

  - ##### opt_customSourceOptions: unknown

  - ##### opt_customLayerOptions: unknown

  #### Returns ImageLayer<ImageSource>

  WMS Layer.

### createBasicWMSLayerFromDataSource

- createBasicWMSLayerFromDataSource(dataSource: OGC, opt_crossOrigin: string): ImageLayer<ImageSource>

- - Defined in src/map/LayerHelper.js:203

  Create and return a basic WMS layer using an OGC data source.

  #### Parameters

  - ##### dataSource: OGC

    OGC data source.

  - ##### opt_crossOrigin: string

  #### Returns ImageLayer<ImageSource>

  WMS Layer.

### createWMTSLayerFromCapabilitites

- createWMTSLayerFromCapabilitites(capabilitiesURL: string, layerName: string, opt_matrixSet: string, opt_dimensions: Object, opt_customOptions: Object, opt_minResolution: number, opt_maxResolution: number, opt_opacity: number): IPromise<TileLayer<TileSource>>

- - Defined in src/map/LayerHelper.js:267

  Create and return a promise that provides a WMTS layer with source on success, no layer else. The WMTS layer source will be configured by the capabilities that are loaded from the given capabilitiesUrl. The style object described in the capabilities for this layer will be added as key 'capabilitiesStyles' as param of the new layer.

  #### Parameters

  - ##### capabilitiesURL: string

    The getCapabilities url.

  - ##### layerName: string

    The name of the layer.

  - ##### opt_matrixSet: string

  - ##### opt_dimensions: Object

  - ##### opt_customOptions: Object

  - ##### opt_minResolution: number

  - ##### opt_maxResolution: number

  - ##### opt_opacity: number

  #### Returns IPromise<TileLayer<TileSource>>

  A Promise with a layer (with source) on success, no layer else.

### createWMTSLayerFromCapabilititesObj

- createWMTSLayerFromCapabilititesObj(capabilities: Object, layerCap: Object, opt_dimensions: Object): TileLayer<TileSource>

- - Defined in src/map/LayerHelper.js:333

  Create and return a WMTS layer using a formatted capabilities response and a capability layer.

  #### Parameters

  - ##### capabilities: Object

    The complete capabilities object of the service

  - ##### layerCap: Object

    The layer capability object

  - ##### opt_dimensions: Object

  #### Returns TileLayer<TileSource>

  WMTS layer

### fixResolution_

- fixResolution_(opt_maxResolution: any): number

- - Defined in src/map/LayerHelper.js:241

  Small hack to get perfect sync with the on resolution status and the zoom to resolution.

  #### Parameters

  - ##### opt_maxResolution: any

  #### Returns number

  fixed maximum resolution.

### getFlatLayers

- getFlatLayers(layer: BaseLayer): Layer<Source, any>[]

- - Defined in src/map/LayerHelper.js:456

  Get an array of all layers in a group. The group can contain multiple levels of others groups.

  #### Parameters

  - ##### layer: BaseLayer

    The base layer, mostly a group of layers.

  #### Returns Layer<Source, any>[]

  Layers.

### getFlatLayers_

- getFlatLayers_(layer: BaseLayer, array: Layer<Source, any>[], computedOpacity: number): Layer<Source, any>[]

- - Defined in src/map/LayerHelper.js:481

  Get an array of all layers in a group. The group can contain multiple levels of others groups. When we flatten a group, we get the child layers. If opacity is defined on the group, this value is lost. Computed opacity is a custom 'back-up' value that contains the calculated value of all ancestors and the given layer.

  #### Parameters

  - ##### layer: BaseLayer

    The base layer, mostly a group of layers.

  - ##### array: Layer<Source, any>[]

    An array to add layers.

  - ##### computedOpacity: number

    Opacity inherited from ancestor layer groups.

  #### Returns Layer<Source, any>[]

  Layers.

### getGroupFromMap

- getGroupFromMap(map: Map, groupName: string): LayerGroup

- - Defined in src/map/LayerHelper.js:430

  Retrieve (or create if it doesn't exist) and return a group of layer from the base array of layers of a map. The given name is used as unique identifier. If the group is created, it will be automatically added to the map.

  #### Parameters

  - ##### map: Map

    A map.

  - ##### groupName: string

    The name of the group.

  #### Returns LayerGroup

  The group corresponding to the given name.

### getLayerByName

- getLayerByName(layerName: string, layers: BaseLayer[]): BaseLayer

- - Defined in src/map/LayerHelper.js:511

  Get a layer that has the LAYER_NODE_NAME_KEY property equal to a given layer name from an array of layers. If one of the layers in the array is a group, then the layers contained in that group are searched as well.

  #### Parameters

  - ##### layerName: string

    The name of the layer we're looking for.

  - ##### layers: BaseLayer[]

    Layers.

  #### Returns BaseLayer

  Layer.

### getQuerySourceIds

- getQuerySourceIds(layer: ImageLayer<ImageSource>): number[]

- - Defined in src/map/LayerHelper.js:706

  #### Parameters

  - ##### layer: ImageLayer<ImageSource>

    The WMS layer.

  #### Returns number[]

  List of query source ids, a.k.a. the data source ids this layer is composed of.

### getWMSLegendURL

- getWMSLegendURL(url: string, layerName: string, opt_scale: number, opt_legendRule: string, opt_legendWidth: number, opt_legendHeight: number, opt_servertype: string, opt_dpi: number, opt_bbox: number[], opt_srs: string, opt_additionalQueryString: Object): string

- - Defined in src/map/LayerHelper.js:563

  Get the WMS legend URL for the given node.

  #### Parameters

  - ##### url: string

    The base url of the wms service.

  - ##### layerName: string

    The name of a wms layer.

  - ##### opt_scale: number

  - ##### opt_legendRule: string

  - ##### opt_legendWidth: number

  - ##### opt_legendHeight: number

  - ##### opt_servertype: string

  - ##### opt_dpi: number

  - ##### opt_bbox: number[]

  - ##### opt_srs: string

  - ##### opt_additionalQueryString: Object

  #### Returns string

  The legend URL or undefined.

### getWMTSLegendURL

- getWMTSLegendURL(layer: TileLayer<TileSource>): string

- - Defined in src/map/LayerHelper.js:534

  Get the WMTS legend URL for the given layer.

  #### Parameters

  - ##### layer: TileLayer<TileSource>

    Tile layer as returned by the ngeo layerHelper service.

  #### Returns string

  The legend URL or undefined.

### isLayerVisible

- isLayerVisible(layer: BaseLayer, map: Map): boolean

- - Defined in src/map/LayerHelper.js:631

  Returns if this layer is visible at the current resolution.

  #### Parameters

  - ##### layer: BaseLayer

    Layer.

  - ##### map: Map

    Map.

  #### Returns boolean

  Is the layer currently visible?

### refreshWMSLayer

- refreshWMSLayer(layer: TileLayer<TileSource> | ImageLayer<ImageSource>): void

- - Defined in src/map/LayerHelper.js:648

  Force a WMS layer to refresh using a random value.

  #### Parameters

  - ##### layer: TileLayer<TileSource> | ImageLayer<ImageSource>

    Layer to refresh.

  #### Returns void

### setZIndexToFirstLevelChildren

- setZIndexToFirstLevelChildren(element: BaseLayer | LayerGroup, ZIndex: number): void

- - Defined in src/map/LayerHelper.js:666

  Set ZIndex property to first level children elements

  #### Parameters

  - ##### element: BaseLayer | LayerGroup

    The group of layer with first level children layers.

  - ##### ZIndex: number

    The ZIndex for children element.

  #### Returns void

### updateWMSLayerState

- updateWMSLayerState(layer: ImageLayer<ImageSource>, names: string, opt_time: string): void

- - Defined in src/map/LayerHelper.js:683

  Update the LAYERS parameter of the source of the given WMS layer.

  #### Parameters

  - ##### layer: ImageLayer<ImageSource>

    The WMS layer.

  - ##### names: string

    The names that will be used to set the LAYERS parameter.

  - ##### opt_time: string

  #### Returns void

Generated using TypeDoc