<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Thanks for the answer,<br>but that solution in my case works only with Chrome Browser.<br>In Chrome also works the two-select solution.<br>With any other browser:<br>two-select works only the upper layer<br>one-select doesn't work any layer<br><br><br>-- <br>Willy<br><br><br><br>&gt; Date: Wed, 26 May 2010 09:43:54 +0200<br>&gt; Subject: Re: [OpenLayers-Users] SelectFeature working at the same time in      two different overlays?<br>&gt; From: bartvde@osgis.nl<br>&gt; To: gruppi@willygroup.org<br>&gt; CC: users@openlayers.org<br>&gt; <br>&gt; Use 1 SelectFeature Control and initialize it with an array of layers.<br>&gt; <br>&gt;     /**<br>&gt;      * Constructor: OpenLayers.Control.SelectFeature<br>&gt;      * Create a new control for selecting features.<br>&gt;      *<br>&gt;      * Parameters:<br>&gt;      * layers - {&lt;OpenLayers.Layer.Vector&gt;}, or an array of vector layers.<br>&gt; The<br>&gt;      *     layer(s) this control will select features from.<br>&gt;      * options - {Object}<br>&gt;      */<br>&gt; <br>&gt; Best regards,<br>&gt; Bart<br>&gt; <br>&gt; &gt; Hi,<br>&gt; &gt; I've two overlays, one is a Vector layers of markers built from a kml<br>&gt; &gt; file,<br>&gt; &gt; the other is a GML geometric layer from an xml file.<br>&gt; &gt; I've added a SelectFeature for each layer, but if I add first layer1 then<br>&gt; &gt; layer2<br>&gt; &gt; only selectFeature for layer2 work. On otherwise if I add layer2 then<br>&gt; &gt; layer1<br>&gt; &gt; only<br>&gt; &gt; selectFeature for layer1 work, there is a way to make working both layers?<br>&gt; &gt; Here the code:<br>&gt; &gt;<br>&gt; &gt; var layer1 = new OpenLayers.Layer.Vector("Segnalazioni", {<br>&gt; &gt;     'displayInLayerSwitcher':false,<br>&gt; &gt;     styleMap: new OpenLayers.StyleMap(style),<br>&gt; &gt;     projection: map.displayProjection,<br>&gt; &gt;     strategies: [new OpenLayers.Strategy.Fixed()],<br>&gt; &gt;     protocol: new OpenLayers.Protocol.HTTP({<br>&gt; &gt;         url: "file.kml",<br>&gt; &gt;         format: new OpenLayers.Format.KML({<br>&gt; &gt;             extractStyles: false,<br>&gt; &gt;             extractAttributes: true<br>&gt; &gt;         })<br>&gt; &gt;     })<br>&gt; &gt; });<br>&gt; &gt;<br>&gt; &gt; var  layer2 = new OpenLayers.Layer.GML(<br>&gt; &gt;     "GML",<br>&gt; &gt;     "file.xml",<br>&gt; &gt;     {<br>&gt; &gt;         projection: map.displayProjection,<br>&gt; &gt;         styleMap: myStyleMap,<br>&gt; &gt;         'displayInLayerSwitcher':false,<br>&gt; &gt;         'isBaseLayer':false<br>&gt; &gt;     }<br>&gt; &gt; );<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; selectControl = new OpenLayers.Control.SelectFeature(<br>&gt; &gt;     layer2,<br>&gt; &gt;     {<br>&gt; &gt;         clickout: true, toggle: true,<br>&gt; &gt;         multiple: false, hover: true<br>&gt; &gt;     }<br>&gt; &gt; );<br>&gt; &gt;<br>&gt; &gt; layer2.events.on(<br>&gt; &gt;     {<br>&gt; &gt;         "featureselected": function(e) {<br>&gt; &gt;             alert("Selected.");<br>&gt; &gt;         },<br>&gt; &gt;         "featureunselected": function(e) {<br>&gt; &gt;             alert("Unselected.");<br>&gt; &gt;         }<br>&gt; &gt;     }<br>&gt; &gt; );<br>&gt; &gt;<br>&gt; &gt; map.addControl(selectControl);<br>&gt; &gt; selectControl.activate();<br>&gt; &gt;<br>&gt; &gt; select = new OpenLayers.Control.SelectFeature(layer1);<br>&gt; &gt; layer1.events.on(<br>&gt; &gt;     {<br>&gt; &gt;         "featureselected": onFeatureSelect,<br>&gt; &gt;         "featureunselected": onFeatureUnselect<br>&gt; &gt;     }<br>&gt; &gt; );<br>&gt; &gt;<br>&gt; &gt; map.addControl(select);<br>&gt; &gt; select.activate();<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Users mailing list<br>&gt; &gt; Users@openlayers.org<br>&gt; &gt; http://openlayers.org/mailman/listinfo/users<br>&gt; &gt;<br>&gt; <br>&gt; <br>                                               <br /><hr />Un mondo di personalizzazioni <a href='http://www.pimpit.it/' target='_new'>per Messenger, PC e cellulare</a></body>
</html>