I'm using Open Layers 3 with the ol.control.LayerSwitcher plugin and I wanted to know how I can get it when I change a layer in the switcher. I was looking for a lot on the internet and I can not find a solution to this. The idea is when the change or the selection of a layer is made using the plugin ol.control.LayerSwitcher perform an action such as an alert.
If someone could give me a help or an alternative to this. If you know of another alternative that does not use ol.control.LayerSwitcher and determine the change event of a specific layer, I would like to know.
Let's say I have three layers in the switcher.
- Layer1
- Layer2
- Layer3.
By default it is in Layer1. If I change or select the Layer2 I would like it to execute an alert. But as long as Layer2 is selected. That would have to be an event.