[OpenLayers-Users] zIndexing across multiple vector layers

dalsinao dalsinao at yahoo.es
Tue Feb 17 05:26:12 EST 2009


Hi,

Ok, here is what happens in my case:

I get two layers from a WFS server on my map (let's say layer_A and
layer_B). These layers contain point geometry features that I display on the
map using an external graphics.
I have added the singleroot patch (ticket #1666) to be able to select
features from any of these WFS (vector-based) layers. When a feature is
selected, I open a separate window showing the feature properties.

It happens in some occasions that features from layer_A and features from
layer_B are at the exact same location. 
For these situations, I've added some code to create a popup menu that
appears on right-click and allows the user to choose which feature he/she
wants to check (the features to choose from may belong to layer_A or
layer_B). 
When a feature is selected, I want the externalGraphic used to display the
feature to be moved forward, so the user can see the one that is selected.
In this cases, playing with the z-index does not help, since the features
may belong to different overlays.

So, this is my question. What should I do in order to put features from one
layer on top of features from another one? Both layers are of
OpenLayers.Layer.WFS type, and I have applied the singleroot.5.patch to the
OL source code.

I hope that this makes the context clear.

Thanks a lot for your help!
Cheers,
David


Andreas Hocevar-2 wrote:
> 
> Hi,
> 
> On Mon, Feb 16, 2009 at 2:57 PM, dalsinao <dalsinao at yahoo.es> wrote:
>> I want to be able to change the z-order of features on Vector layers. I
>> have
>> checked this Z-Index ordering example (ordering.html) and it works when
>> you
>> are dealing with a single Vector layer; however, I have more than one
>> vector
>> layer and it may happen that features from different layers are located
>> one
>> on top of the other.
> 
> That's the concept of a layer. Layers are like a stack of paper
> sheets. You can have only one sheet on top, but if your sheets are
> transparent, only parts of sheets lying below will be obscured.
> 
>> In these cases I want to be able to change the feature displayed on top,
>> regardless of which layer the feature belongs.
> 
> Then you have to make sure your features are all on the same layer.
> There are several ways for populating a vector layer with features
> from many sources, and you can even group them by setting feature
> attributes.
> 
>> I have tried playing with the graphicZIndex, but it only seems to affect
>> features on the same layer and it does not help to go on top of features
>> in
>> separate layers.
> 
> This is by design.
> 
> If you can give us a bit more context of your application, it will be
> easier for us to give you an advice how to solve your problem.
> 
> Regards,
> Andreas.
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/zIndexing-across-multiple-vector-layers-tp2334946p2340064.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list