Hi again, Thanks a lot for your answers, they have been really very helpful and I've managed to solve my problem. Below I added a couple of comments to your comments to explain what I've done.
Thanks again to both of you, David > >Hi, > >On Tue, Feb 17, 2009 at 11:26 AM, dalsinao <[email protected]> wrote: >> 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). > >Wait: the SVG/VML event model will just return the feature that is on >top. So what you are doing here must be something like in the >selectBox method of Control.SelectFeature. > Yes. In fact, I use code I found in patch mf_selectcontrol.patch (ticket #434) to calculate which features intersect at the location of the top feature that has been selected. >> 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. > >At this point you already know which feature is selected. I see two >ways to bring it to the top: > * determine the layer (feature.layer) and move the layer on top of >the other (e.g. using map.raiseLayer) > * move the selected feature to a separate (temporary) layer which is on > top > This is just the answer I was looking for :-) I've finally implemented the option of moving the containing layer to the top (through map.raiseLayer). This option seems to work, so I will not try for the time being the other ones (moving the selected features to a separate layer on top or merging all WFS data sources in one layer), unless there is some good reason to go for them, which I don't see at the moment, do you? >> 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. > >You cannot move layers from one layer on top of another layer without >changing layer order or moving the feature to a layer above. > >An alternative would be to merge both WFS data sources into one layer. > >Andreas. > -- View this message in context: http://n2.nabble.com/zIndexing-across-multiple-vector-layers-tp2334946p2347504.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
