[OpenLayers-Users] Z-Index of Markers Layer

Eric Lemoine eric.c2c at gmail.com
Sun Jun 1 05:39:07 EDT 2008


On Fri, May 30, 2008 at 1:13 AM, bradleyspencer <brad at cubewerx.com.au> wrote:
> Eric,
>
> The hack suggestion did not work, or at least I am unable to make it work :(
>
> My latest attempt to sort this almost worked.
>
> Given that the OL defaults are Z_INDEX_BASE: { BaseLayer: 100, Overlay: 325, Popup: 750, Control: 1000 }, I made sure that all my user layers were set in the correct overlay levels within the range 325 thru 700 Zindex. Then I set the levels of the two markers to be offset from the Popup default level by -1 and -2 by using 'myMarkerLayer'.setZIndex(map.Z_INDEX_BASE['Popup'] - 1 & 2). This worked fine if I just wanted to see the marker layers and the popups together. However, once I plotted my other layers they simply stamped over the top of the markers and popup layers.


I dont see why the following wouldn't work:


myMakerLayer0 = new OpenLayer.Layer.Markers();
myMakerLayer1 = new OpenLayer.Layer.Markers();
map.addLayers([myMarkerLayer0, myMarkerLayer1]);
// set the zindex after the layers are added to the map
myMakerLayer0.setZIndex(map.Z_INDEX_BASE['Popup'] - 1);
myMakerLayer1.setZIndex(map.Z_INDEX_BASE['Popup'] - 2);

myOverlayLayer0 = new OpenLayers.Layer();
myOverlayLayer1 = new OpenLayers.Layer();
map.addLayers([myOverlayLayer0, myOverlayLayer1]);

> Is there a way to interrogate the ZIndex of any given layer so that I can check what is going on?

layer.div.style.zIndex

Hope this is helping...

--
Eric



More information about the Users mailing list