[OpenLayers-Users] Control.WMSGetFeatureInfo problem

Andreas Hocevar ahocevar at opengeo.org
Thu Sep 3 10:49:23 EDT 2009


Hi Steve,

Steve.Toutant at inspq.qc.ca wrote:
> When I define the Control.WMSGetFeatureInfo if I don't specify the
> "layers:" properties, every visible layers with a Template in the
> mapfile are queried and I get the results. That is as expected. My
> problem is when I want to specify one layer to query. The request is
> not launched (I see nothing in firebug). Here is the code
>
> test = new OpenLayers.Layer.WMS('HLM',
> 'http://10.2.192.247/cgi-bin/mapserv.exe?map=/ms4w/paccSante/map/paccsante_chaleur.map&',
> {layers: 'HLM', transparent: "true", format:"image/gif"},{isBaseLayer:
> false, visibility: false,singleTile:true});
> map.addLayer(test);

Note: visibilty is set to false. This means that the layer will be hidden.

> infoControls =
> {
> click: new OpenLayers.Control.WMSGetFeatureInfo({
> url:
> 'http://10.2.192.247/cgi-bin/mapserv.exe?map=/ms4w/paccSante/map/paccsante_chaleur.map',
>
> title: 'Identify features by clicking',
> layers: [test],
> queryVisible: true,
> infoFormat:'text/html'
> })
> }

Note: queryVisible is set to true. This means that hidden layers won't
be queried.

So the behavior that the control does not issue any request is correct.
Set queryVisible to false, and you will be fine. If it still does not
work, remove the url property from the control config. This will be
taken from the layer and may prevent the control from issuing queries if
different from the layer url.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list