<br><font size=2 face="sans-serif">I moved the control creation just before
</font>
<br><font size=2 face="sans-serif">map.addLayer(test);</font>
<br><font size=2 face="sans-serif">And it is working. The query is done
just for the specified layer.</font>
<br>
<br><font size=2 face="sans-serif">So,</font>
<br><font size=2 face="sans-serif">test = new OpenLayers.Layer.WMS('HLM',
.....);</font>
<br><font size=2 face="sans-serif">&nbsp;</font>
<br><font size=2 face="sans-serif">infoControls = </font>
<br><font size=2 face="sans-serif">{.......}</font>
<br><font size=2 face="sans-serif">map.addLayer(test);</font>
<br><font size=2 face="sans-serif">works</font>
<br>
<br><font size=2 face="sans-serif">Someone can explain why I should define
the control before adding the layer to the map. Because that means I must
reorganise my code.</font>
<br><font size=2 face="sans-serif">thanks</font>
<br><font size=2 face="sans-serif">Steve</font>
<br><font size=2 face="sans-serif"><br>
</font><font size=3 color=#0066ff><i>Steve Toutant, M. Sc.</i></font><font size=3><br>
Analyste en géomatique<br>
Secteur environnement<br>
Direction des risques biologiques, environnementaux et occupationnels<br>
Institut national de santé publique du Québec<br>
945, avenue Wolfe<br>
Québec, Qc G1V 5B3 </font>
<p><font size=3>Tél.: (418) 650-5115 #5281<br>
Fax.: (418) 654-3144</font><font size=3 color=blue><u><br>
</u></font><a href=mailto:steve.toutant@inspq.qc.ca><font size=3 color=blue><u>steve.toutant@inspq.qc.ca</u></font></a><font size=3 color=blue><u><br>
</u></font><a href=http://www.inspq.qc.ca/><font size=3 color=blue><u>http://www.inspq.qc.ca</u></font></a>
<p><font size=3>&nbsp; </font>
<p>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Andreas Hocevar &lt;ahocevar@opengeo.org&gt;</b>
</font>
<p><font size=1 face="sans-serif">03/09/2009 10:49 AM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif">Steve.Toutant@inspq.qc.ca</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">users@openlayers.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">Re: [OpenLayers-Users] Control.WMSGetFeatureInfo
problem</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br>
<br>
<br><tt><font size=2>Hi Steve,<br>
<br>
Steve.Toutant@inspq.qc.ca wrote:<br>
&gt; When I define the Control.WMSGetFeatureInfo if I don't specify the<br>
&gt; &quot;layers:&quot; properties, every visible layers with a Template
in the<br>
&gt; mapfile are queried and I get the results. That is as expected. My<br>
&gt; problem is when I want to specify one layer to query. The request
is<br>
&gt; not launched (I see nothing in firebug). Here is the code<br>
&gt;<br>
&gt; test = new OpenLayers.Layer.WMS('HLM',<br>
&gt; 'http://10.2.192.247/cgi-bin/mapserv.exe?map=/ms4w/paccSante/map/paccsante_chaleur.map&amp;',<br>
&gt; {layers: 'HLM', transparent: &quot;true&quot;, format:&quot;image/gif&quot;},{isBaseLayer:<br>
&gt; false, visibility: false,singleTile:true});<br>
&gt; map.addLayer(test);<br>
<br>
Note: visibilty is set to false. This means that the layer will be hidden.<br>
<br>
&gt; infoControls =<br>
&gt; {<br>
&gt; click: new OpenLayers.Control.WMSGetFeatureInfo({<br>
&gt; url:<br>
&gt; 'http://10.2.192.247/cgi-bin/mapserv.exe?map=/ms4w/paccSante/map/paccsante_chaleur.map',<br>
&gt;<br>
&gt; title: 'Identify features by clicking',<br>
&gt; layers: [test],<br>
&gt; queryVisible: true,<br>
&gt; infoFormat:'text/html'<br>
&gt; })<br>
&gt; }<br>
<br>
Note: queryVisible is set to true. This means that hidden layers won't<br>
be queried.<br>
<br>
So the behavior that the control does not issue any request is correct.<br>
Set queryVisible to false, and you will be fine. If it still does not<br>
work, remove the url property from the control config. This will be<br>
taken from the layer and may prevent the control from issuing queries if<br>
different from the layer url.<br>
<br>
Regards,<br>
Andreas.<br>
<br>
-- <br>
Andreas Hocevar<br>
OpenGeo - http://opengeo.org/<br>
Expert service straight from the developers.<br>
<br>
</font></tt>
<br>
<br>
<br>