I am trying to create an OpenLayers map in which I can highlight a selected point feature by putting another graphic around it, such as this red box:

Reticule above

What I have done so far is to add a vector layer with a single point feature, and a styleMap that displays the reticule as its externalGraphic. I then move the feature and display it when I want to highlight something, or hide the feature when I don't. This works reasonably well, but I currently have to choose between one of two options, but each has a disadvantage I want to avoid.

Option 1: Correct display, incorrect interaction.

The display is as above, exactly as I want it, but features "covered" by the transparent reticule can no longer be clicked. I achieve this by adding the reticule layer to the SelectFeature control and using setLayerIndex to move it the top. This means that hovering over or clicking on any other features within the red square has no effect.

Option 2: Incorrect display, correct interaction.

If instead I don't add the reticule layer to the SelectFeature control, I can successfully click on any of the selectable features to move the reticule to them. However no matter what I set the z-index of the reticule layer or its feature to, all of the features added to the SelectFeature obscure it, as in this image:

Reticule below

So my question is, how can I achieve the combined effect? I want the highlighting reticule above all features, but to have no interaction with the mouse events. Is there a better way than defining this separate layer for the highlight image? If this is the best way to go, can I pass any click or hover events through the reticule layer to the feature layers below it?

1 Answer 1


I will need to do something similar in my app and I found this as a possible clue/lead.


As the answer there suggests, you probably don't want to modify the OL code directly, but instead have your own code override it runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.