new LayerHelper($q, $http, ngeoTilesPreloadingLimit)
Provides help functions that helps you to create and manage layers.
Parameters:
Name | Type | Description |
---|---|---|
$q |
angular.$q | Angular promises/deferred service. |
$http |
angular.$http | Angular http service. |
ngeoTilesPreloadingLimit |
number | Load tiles up to preload levels. By default preload is Infinity, which means load all tiles on the top of the visible level. See also preload value in documentation for ol.Layer.Tile. |
Members
(static, constant) GROUP_KEY
(static, constant) REFRESH_PARAM
Methods
createBasicGroup([opt_layers]opt)
Create and return an ol.layer.Group. You can pass a collection of layers to directly add them in the returned group.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
[opt_layers] |
ol.Collection. |
<optional> |
The layer to add to the returned Group. |
Returns:
Layer group.
createBasicWMSLayer(sourceURL, sourceLayersName, sourceFormat, [opt_serverType]opt, [opt_time]opt, [opt_params]opt, [opt_crossOrigin]opt)
Create and return a basic WMS layer with only a source URL and a comma
separated layers names (see ol.source.ImageWMS
).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sourceURL |
string | The source URL. |
|
sourceLayersName |
string | A comma separated names string. |
|
sourceFormat |
string | Image format, for example 'image/png'. |
|
[opt_serverType] |
string= |
<optional> |
Type of the server ("mapserver", "geoserver", "qgisserver", …). |
[opt_time] |
string= |
<optional> |
time parameter for layer queryable by time/periode |
[opt_params] |
Object. |
<optional> |
WMS parameters. |
[opt_crossOrigin] |
string= |
<optional> |
crossOrigin. |
Returns:
WMS Layer.
createWMTSLayerFromCapabilitites(capabilitiesURL, layerName, [opt_matrixSet]opt, [opt_dimensions]opt)
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:
Name | Type | Attributes | Description |
---|---|---|---|
capabilitiesURL |
string | The getCapabilities url. |
|
layerName |
string | The name of the layer. |
|
[opt_matrixSet] |
string= |
<optional> |
Optional WMTS matrix set. |
[opt_dimensions] |
Object. |
<optional> |
WMTS dimensions. |
Returns:
A Promise with a layer (with source) on success, no layer else.
getFlatLayers(layer)
Get an array of all layers in a group. The group can contain multiple levels of others groups.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Base | The base layer, mostly a group of layers. |
Returns:
Layers.
getGroupFromMap(map, groupName)
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:
Name | Type | Description |
---|---|---|
map |
ol.Map | A map. |
groupName |
string | The name of the group. |
Returns:
The group corresponding to the given name.
getLayerByName(layerName, layers)
Get a layer that has a layerName
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:
Name | Type | Description |
---|---|---|
layerName |
string | The name of the layer we're looking for. |
layers |
Array. |
Layers. |
Returns:
Layer.
getWMSLegendURL(url, layerName, [opt_scale]opt, [opt_legendRule]opt)
Get the WMS legend URL for the given node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string|undefined | The base url of the wms service. |
|
layerName |
string | The name of a wms layer. |
|
[opt_scale] |
number= |
<optional> |
A scale. |
[opt_legendRule] |
string= |
<optional> |
rule parameters to add to the returned URL. |
Returns:
The legend URL or undefined.
getWMTSLegendURL(layer)
Get the WMTS legend URL for the given layer.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Tile | Tile layer as returned by the ngeo layerHelper service. |
Returns:
The legend URL or undefined.
isLayerVisible(layer, map)
Returns if this layer is visible at the current resolution.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Base | Layer. |
map |
ol.Map | Map. |
Returns:
Is the layer currently visible?
refreshWMSLayer(layer)
Force a WMS layer to refresh using a random value.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Image|ol.layer.Tile | Layer to refresh. |
setZIndexToFirstLevelChildren(element, ZIndex)
Set ZIndex property to first level children elements
Parameters:
Name | Type | Description |
---|---|---|
element |
ol.layer.Group|ol.layer.Base | The group of layer with first level children layers. |
ZIndex |
number | The ZIndex for children element. |
updateWMSLayerState(layer, names, [opt_time]opt)
Update the LAYERS parameter of the source of the given WMS layer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
layer |
ol.layer.Image | The WMS layer. |
|
names |
string | The names that will be used to set the LAYERS parameter. |
|
[opt_time] |
string= |
<optional> |
The start and optionally the end datetime (for time range selection) selected by user in a ISO-8601 string datetime or time interval format |