However, I am looking to load a WMS layer from geoserver and extract only this WMS layer to make a process and display something on canvas. On Openlayers 2 it could be done with layerContainerDiv extracting the element that contains all the layers and taking the required one. But it seems that in Openlayers 3 cannot be done. I have tried something similar to this example (take into account that this example gives a cross-origin error, but not in my server), but without success as all the layers are processed and cannot be distinguished.
Does someone know how can layers can be distinguished or separated to process them independently?
I found the Layer Spy Example which it seems that making use of
postcompose could be a possibility, but using the options of ol.Map I can find the 2 layers by
map.getLayers().getLength(). And I can find the array of the WMS with
map.getLayers().getArray() but how to take the layer context?