<div dir="ltr">Hi Marc-André,<div><br></div><div>I've had a similar problem, and it's pretty hard to fix.</div><div>The way I fixed it was to add a click event on the WMS layer, and when the WMS layer is clicked, get the mouse position and then manually check what was selected.</div>
<div>Here pos is an object where pos.x is the x position of the mouse and pos.y is the y position of the mouse:</div><div><br></div><div>var target = document.elementFromPoint(pos.x, pos.y)<br></div><div><div> if (target && target._featureId) {</div>
<div>                        //It's possible to have multiple vector layers, so we have to loop through all of them to found out what we clicked on.</div><div>                        for (var i in wfslayers) {</div><div>
                            //Find the corresponding feature by id</div><div>                            var feature = wfslayers[i].getFeatureById(target._featureId);</div><div>                            if (feature) {</div>
<div>                                //If feature is found, it won't be null or undefined. Then we can select it, and break the for loop.</div><div>                                select.select(feature);</div><div>                                break;</div>
<div>                            }</div><div>                        }</div><div>                    }</div></div><div><br></div><div>I hope this was enough to solve your problem, if you need more information don't hesitate to ask.</div>
<div><br></div><div>Steven den Hartog</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/18 Marc-André Trottier <span dir="ltr"><<a href="mailto:trottier.marcandre@gmail.com" target="_blank">trottier.marcandre@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have a selectFeature define on my vector layer :<div><div>so, 'featureselected' event never start because my WMS layer is on top.</div>
<div>i looked for start manually the event but i was stopped when i saw on line #212 of Feature.js, the param 'evt' don't have the polygon who must be selected. </div>
<div>How can i do this ?</div><div><br></div><div>P.S.: all that start with IE 8, because it can not support correctly labelling on layer vector. </div></div><div>on IE 8, label is selected when you pass over and the polygon is unselected. </div>

<div><br></div><div>some code : </div><div><br></div><div><div>reg_admin = new OpenLayers.Layer.Vector("reg_admin", {</div><div><span style="white-space:pre-wrap">           </span>isBaseLayer:false,</div><div><span style="white-space:pre-wrap">               </span>rendererOptions: {zIndexing: true},</div>

<div><span style="white-space:pre-wrap">          </span>minResolution: 1200,</div><div><span style="white-space:pre-wrap">             </span>maxResolution: 5000,</div><div><span style="white-space:pre-wrap">             </span>clone:"",</div>

<div><span style="white-space:pre-wrap">          </span>strategies: [new OpenLayers.Strategy.BBOX()],</div><div><span style="white-space:pre-wrap">            </span>protocol: new OpenLayers.Protocol.WFS({</div><div><span style="white-space:pre-wrap">                  </span>url:  "/cgi-wms/mapserv?map=dpop&service=wfs&version=1.1.0",</div>

<div><span style="white-space:pre-wrap">                  </span>featureType: "dpop_criminalite_generale_v_s",</div><div><span style="white-space:pre-wrap">                  </span>geometryName: "geom_s"</div><div><span style="white-space:pre-wrap">         </span>}),</div>

<div><span style="white-space:pre-wrap">          </span>filter:</div><div><span style="white-space:pre-wrap">                  </span>new OpenLayers.Filter.Comparison({</div><div><span style="white-space:pre-wrap">                                               </span>type: OpenLayers.Filter.Comparison.EQUAL_TO,</div>

<div><span style="white-space:pre-wrap">                                          </span>property: "year",</div><div><span style="white-space:pre-wrap">                                              </span>value: "2012"</div><div>                    })</div><div><span style="white-space:pre-wrap">     </span>});</div>

</div><div><br></div><div><div>reg_admin.events.on({</div><div><span style="white-space:pre-wrap">                      </span>'featureselected': function(e) {</div><div><span style="white-space:pre-wrap">                         </span><span>bla bla bla</span></div>

<div><span style="white-space:pre-wrap">                  </span>},</div><div><span style="white-space:pre-wrap">                       </span>'featureunselected': function(e) {</div><div><span style="white-space:pre-wrap">                               bla bla bla</span></div>

<div><span style="white-space:pre-wrap">                  </span>}</div><div><span style="white-space:pre-wrap">                </span>});</div></div><div><br></div><div><div>var selecthover = new OpenLayers.Control.SelectFeature(</div><div><span style="white-space:pre-wrap">                </span>reg_admin,</div>

<div><span style="white-space:pre-wrap">          </span>{</div><div><span style="white-space:pre-wrap">                </span>  multiple: false,</div><div><span style="white-space:pre-wrap">               </span>  hover: true</div><div><span style="white-space:pre-wrap">            </span>}</div>

<div><span style="white-space:pre-wrap">  </span>);</div><div><br></div><div><div>numeroRegion = new OpenLayers.Layer.WMS( "numberOnly",</div><div><span style="white-space:pre-wrap">                                                                    </span>  '/cgi-wms/adnInternetV2?',</div>

<div><span style="white-space:pre-wrap">                                                                  </span> {layers: 'numberOnly',</div><div><span style="white-space:pre-wrap">                                                                  </span>   format: szFormat,</div><div><span style="white-space:pre-wrap">                                                                     </span>  transparent: true,</div>

<div><span style="white-space:pre-wrap">                                                                  </span>  NOCACHE: Math.random()</div><div><span style="white-space:pre-wrap">                                                                 </span> },</div><div><span style="white-space:pre-wrap">                                                                      </span> oWMSOverlayOptions</div>

<div><span style="white-space:pre-wrap">  </span>);</div><div>numeroRegion.setVisibility(true);</div><div>numeroRegion.displayInLayerSwitcher = false;</div></div><div><br></div><div>map.addControl(selecthover);</div><div>

selecthover.activate();</div><div>map.addLayers([fondRelief, reg_admin, numeroRegion ]);</div></div><div><br></div><div><br></div><div><br></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br></blockquote></div><br></div>