Ok, I found the error. The URL property define at WMSGetFeatureInfo must
exactly match the layer WMS URL defined at the layer level, according to the
urlMatches function defined at WMSGetFeatureInfo.js .

I don't really think this behavior is the best approach to the problem.  At
least it doesn't seem to be fully coherent. Have a look at the source code
comments regarding the url property found in WMSGetFeatureInfo.js:

 

/**

    * Property: url

     * {String} The URL of the WMS service to use.  If not provided, the url

   *     of the first eligible layer will be used.

   */

   url: null,

 

This URL will only be used in case it matches either the control url or  the
layer url. So imagine we have define the layer url in two steps: first the
wms server and then the correct layer name using the layer map: property
(the map file in my case). If this is the case, the layer level url will
never be complete (since it is only compose by the wms server url without a
layer reference). Therefore, no matter how you define it, the
WMSGetFeatureInfo url will be always ignored since the urlMatches function
will return false.

 

To me, this behavior is really confusing.

 

Manu

 

 

 

De: Manuel Aymerich [mailto:[email protected]] 
Enviado el: martes, 14 de diciembre de 2010 18:25
Para: '[email protected]'
Asunto: WMS getFeatureInfo not throwing query requests

 

Hi,

 

I trying to retrieve info via WMS getFeatureInfo and display it in OL
through a popup. The maps are being served by Mapserver. Here is my code:

 

var info = new OpenLayers.Control.WMSGetFeatureInfo({            

                      url:
'http://labs.argongra.com/cgi-bin/mapserv?map=/var/datos/SIOSE/maps/SIOSE.ma
p&service=WMS&VERSION=1.1.1' 

                      title: 'Info:',

                      queryVisible: true,

                      layers: [Superficie_Industria],

                      eventListeners: {

                        getfeatureinfo: function(event) {

                                   map.addPopup(new
OpenLayers.Popup.FramedCloud(

                                   "identifier", 

                                   map.getLonLatFromPixel(event.xy),

                                   new OpenLayers.Size(400,100),

                                   event.text,

                                   null,

                                   true

                                   ));

                              }                            

                        }

                      }

                  

                  });

map.addControl(info);

info.activate();

 

 

 

However OL is not sending getFeatureInfo requests to the server (no entries
in the apache access log at least). 

 

I'll explain myself. No popup is shown on the map when the users clicks on
the desired layer (in this case the layer is 'Superficie_Industrila'). After
checking my apache acces log, I can say that not actual getFeatureInfo
request is being sent to the server. The funny thing is that when in OL I
don't specify an url for the WMSGetFeatureInfo control, this time the
request is made, the pop up appears in the map, but of course with the error
'loadMap(): Web application error. CGI variable "map" is not set'. 

 

Manually,  I've double checked that the server is correctly answering
getFeatureInfo requests: 
 
<http://labs.argongra.com/cgi-bin/mapserv?MAP=/var/datos/SIOSE/maps/SIOSE.ma
p&VERSION=1.1.1&service=WMS&REQUEST=GetFeatureInfo&SRS=EPSG:25830&BBOX=28059
6.712452866,4393553.81841292,595201.950892653,4577290.86422365&WIDTH=1327&HE
IGHT=774&LAYERS=Superficie_Industria&QUERY_LAYERS=Superficie_Industria&INFO_
FORMAT=text/html&FEATURE_COUNT=50&X=608&Y=218>
http://labs.argongra.com/cgi-bin/mapserv?MAP=/var/datos/SIOSE/maps/SIOSE.map
&VERSION=1.1.1&service=WMS&REQUEST=GetFeatureInfo&SRS=EPSG:25830&BBOX=280596
.712452866,4393553.81841292,595201.950892653,4577290.86422365&WIDTH=1327&HEI
GHT=774&LAYERS=Superficie_Industria&QUERY_LAYERS=Superficie_Industria&INFO_F
ORMAT=text/html&FEATURE_COUNT=50&X=608&Y=218
 
So if the error is not server side, why is OL not making featureInfoRequests
to the server? Any clues? What am I missing?
 
Thanks in advance,
 
Manu

 

 

 

 

 

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to