Is it possible to display an image layer (WMS or Image) above a vector layer with activated SelectFeature
control in OpenLayers?
The image layer (radar returns) contains only sparse, semi-transparent regions and doesn't significantly obscure the underlying vector layer, whose features I would like to be able to select. It seems reasonable to expect this behaviour from the map.
However, as soon as the OpenLayers.Control.SelectFeature
control for the vector layer is activated, the vector layer is moved to the top of the map, placing it above the image layer. Calls to map.setLayerIndex()
have no effect.
Among many attempts to fix this, I was able to prevent it from occurring by omitting the moveLayerToTop()
function in the OpenLayers code, as suggested here:
Although the image layer now appears above the vector layer, the OpenLayers.Control.SelectFeature
no longer functions whenever the image layer is set to visible.
The image layer appears to be blocking mouse events to the control, although the map itself responds normally. I tried setting the image layer's events.fallThrough
to true but it had no effect. I also (in desperation)
set the layer's pointer-events to none; again, to no effect.
I saw this thread:
OpenLayers how to maintain layer ordering while using SelectFeature control
and was led to the featureclick.js
extension:
https://github.com/openlayers/openlayers/pull/174
I'll likely give that a try next, but am wondering if I've missed something obvious in standard OpenLayers. I haven't found any other solutions posted on the web.