Possible bug: Fixed vector layers and z-indexing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible bug: Fixed vector layers and z-indexing

Frost89
Hi all

I'm trying to add a WMS and a vector layer to my application. The vectorlayer has the isFixed property set to true, so that it won't move when the map is dragged.

This causes the vector layer to be added to the viewport div instead of the layercontainer div. Now, the z-index of the vector layer is still assigned as if it was inside the layercontainer div, which causes it to be rendered below the layercontainer, thus placing the WMS layer on top of it.

Would it be better to add fixed layers to the layercontainer, and then make it fixed. Or is it just impossible to have a fixed layer between non-fixed layers?
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug: Fixed vector layers and z-indexing

Frost89
Sorry for bringing this up again. I would really like to know if this is a bug, or if I'm just doing something wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug: Fixed vector layers and z-indexing

gorybunny
Apologies for resurrecting this, but I have observed this same behaviour in v2.12 of openlayers, using IE9. Vector Layers that have the isFixed property set to true will appear below WMS layers. Should this be registered as a bug?
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug: Fixed vector layers and z-indexing

Andreas Hocevar-2
I wouldn't say this is a bug. What you're seeing is a result of fixed
layers being appended to the parent container of the container that
holds geographic layers. Note that the isFixed property is not part of
the API and was meant for a different purpose: third party mapping
APIs that provide their own dragging (e.g. GMaps).

Having said that, the best you can get is having all fixed layers on
top of all geographic layers, by changing the zIndex of the map's
layerContainerDiv to 0. But this is also not part of the API, so
beware of dragons ahead - this change will have side effects that may
affect your application.

A more API compliant way of solving this would be to create a custom
control, and use an OpenLayers.Renderer to render your vectors to its
div - I'm assuming your fixed layer actually contains some map
decoration like crosshairs.

Andreas.

On Fri, Sep 7, 2012 at 8:25 AM, gorybunny <[hidden email]> wrote:

> Apologies for resurrecting this, but I have observed this same behaviour in
> v2.12 of openlayers, using IE9. Vector Layers that have the isFixed property
> set to true will appear below WMS layers. Should this be registered as a
> bug?
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Possible-bug-Fixed-vector-layers-and-z-indexing-tp3890867p5000339.html
> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev



--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug: Fixed vector layers and z-indexing

gorybunny
Thank you very much for that clear explanation as to the purpose of the isFixed property. Perhaps that snippet of information should be included in the api docs to discourage cowboy developers like myself from misusing it :)

I was indeed trying to implement map decorators like the legend / north arrow above my maps.
Eventually, I went with the simpler(?) route using CSS to position these elements relative to the map div, styled with a z-index of 2000.