I face the following problem.
I have two vector layers. One has linestring and the other point geometry.
When I add this line to my point geometry vector layer:
pointLayer.setZIndex( 1001 );
I get the point layer on top and then I am unable to select any feature from the linestring vector layer.
How can I solve this problem so all the features are clickable? I wouldn't expect this behavior as the point vector layer just has some points.
Best Answer
To solve this problem, you have to look under the hood of the library. The
SelectFeature
control can be applied on a single layer or multiple layers.Vector.RootContainer
layer, which basically a vector layer group containing the layers. The control is then applied to thatRootContainer
layer.This way if you modify the Z index of the original layer, you just block the mouse event from the created layer group. I have two ideas which would help you solve this problem in theory:
RootContainer
layer and modify its position to be on top. You can set the Z-index, but the more convenient way is to use the map'sraiseLayer
function.pointer-events
CSS property of your layers' DOM elements. You can set it tonone
, to get your mouse clicks fall through completely.