[GIS] How to disable layer(not hide) in OpenLayers 3

openlayers

In my map, I have multiple layers.
For certain operations I want to only work on one layer. The other layers should be visible, but disabled, so that they can not be selected or interacted with in any way.

Best Answer

You should be able to pass in the layers option for ol.control.Select and only pass in the layer you want to edit.

http://openlayers.org/en/v3.4.0/apidoc/ol.interaction.Select.html?unstable=true

layers Array. | function experimental A list of layers from which features should be selected. Alternatively, a filter function can be provided. The function will be called for each layer in the map and should return true for layers that you want to be selectable. If the option is absent, all visible layers will be considered selectable.

Related Question