[OpenLayers-Users] select feature with multiple wfs

Lars Lingner ml at lingner.eu
Wed Feb 27 11:19:48 EST 2008


Hello,

currently I'm doing my first steps with OL. I want to setup a map with 
multiple different overlay layers (WFS). The features of these layers 
should expose their attributes on an certain event (like onClick, hover 
etc). Currently I'm just filling an div element with an callback function.

Its working fine if I use just one OpenLayers.Control.SelectFeature



var sf_lines_wfs = new OpenLayers.Control.SelectFeature(lines_wfs,
   {
     onSelect: lineSelected,
     onUnselect: lineUnselected
   }
);
map.addControl(sf_lines_wfs);
sf_lines_wfs.activate();

If I add other OpenLayers.Control.SelectFeature to my other layers  my 
featureinfo function seems to work randomly.

var sf_alt_lines_wfs = new OpenLayers.Control.SelectFeature(alt_lines_wfs,
   {
     onSelect: altLineSelected,
     onUnselect: altLineUnselected
   }
);
map.addControl(sf_alt_lines_wfs);
sf_alt_lines_wfs.activate();

Is this the right way to go?

How can I read and process attributes from different wfs-layers? Each 
WFS-Layer should be accessible through the OL.Layerswitcher

I search the examples of OL but I couldn't find one pushing me the right 
way.

Thanks in advance....

lars




More information about the Users mailing list