I have a TileWMS:
var mapWMSTile = new ol.source.TileWMS(
{
url: '.....',
params: {'LAYERS': 'l1,l2', VERSION: '1.3.0', 'TILED': true},
serverType: 'mapserver'
});
var fieldTile = new ol.layer.Tile(
{
source: mapWMSTile,
name: 'fieldTile'
});
Now I want to add a layers to my WMS parameters (e.g. add l3 in 'LAYERS'). Is this possible?
I have tried the below codes without success:
First try:
mapWMSTile.updateParams(
{
params: {'LAYERS': 'l3', VERSION: '1.3.0', 'TILED': true}
});
Second try:
fieldTile.getSource().updateParams({'LAYERS': 'l3', VERSION: '1.3.0', 'TILED': true});
I am using OpenLayers 3.9.0.