[OpenLayers-Users] Z-Index of Markers Layer

bradleyspencer brad at cubewerx.com.au
Sun Jun 1 08:32:20 EDT 2008


Eric,

Its all sorted now. Thanks for the layer.div.style.zIndex thingy it helped me see that I was assigning the layers to a Zindex that was not what I wanted. So these other layers were always set above the markers layers! 

To make it work for me, i.e. so that the layers were going in the correct band below the Markers (and the Popup), I had to set the index to an increment above the Z_INDEX_BASE[Overlay] and not an absolute number which I was doing. So now when I do this 'map.setLayerZIndex(LanduseHighlight, 0)' it sets the ZIndex of this layer to 325 which is where I want it. 

Anyway, it now works just fine so thanks for your help.

Cheers,

Brad Spencer





-----Original Message-----
From: Eric Lemoine [mailto:eric.c2c at gmail.com]
Sent: Sunday, 1 June 2008 7:39 PM
To: brad at cubewerx.com.au
Cc: openlayers users
Subject: Re: [OpenLayers-Users] Z-Index of Markers Layer


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