I am trying to remove a layer from a layerGroup. However I dont know how to proceed. I have a button where on click of the button , the layer should be removed from the list.
olMap.getLayers().forEach(function(layer, i)
{
if (layer instanceof ol.layer.Group)
{
layer.getLayers().forEach(function(sublayer, j)
{
if(sublayer instanceof ol.layer.Tile)
{
if(count==0)
{
layer.getLayers().remove();
}
}
});
}
});