[Users] WMSGetFeatureInfo() issue

Tim Schaub tschaub at opengeo.org
Mon Mar 22 21:51:52 CET 2010


Kris Nackaerts wrote:
> Hi All,
> 
> First, I'm new to geoExt, apologies when this is a trivial issue.
> 

Welcome!

> The following code is not working correctly. When using firebug, the request that is send to Geoserver is correct, and geoserver returns the expected data. e.text however remains empty. Note the datalayer queried is a 16 bit raster dataset.
> 
> var featureInfo = new OpenLayers.Control.WMSGetFeatureInfo();
> featureInfo.events.on({
>     getfeatureinfo: function(e) {
> 	alert(e.text);
>     }
> });
> 
> 
> map.addControl(featureInfo);
> featureInfo.layers = [bathy];
> featureInfo.activate();
> 
> The issue: e.text remains empty.
> 
> Some additional info:
> 
>     * e.request.statusText='OK'
>     * e.request.status=0
>     * e.request.readyState=4
>     * e.request.responseText="" 
> 

Do you know about the same origin policy?

http://en.wikipedia.org/wiki/Same_origin_policy

If your map is served up from http://localhost/path/to/map and you're 
trying to make a request to http://localhost:8080/geoserver/... then 
you're violating the same origin policy.

If this is your issue, see the following:

http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost

If this is not your issue, it would be easiest to help debug if your 
application was accessible.  (And an OpenLayers list would probably be a 
better fit.)

Tim

> Based on Firebug, I can discover that Geoserver returns the following (by manually copying/pasting the URL request into a new page):
> 
> <html>
>   <head>
>     <title>Geoserver GetFeatureInfo output</title>
>   </head>
>   <style type="text/css"> ...  </style>
>   <body>
>   
> <table class="featureInfo">
>   <caption class="featureInfo">DMT:dmt_original_values_proto</caption>
> 
>   <tr>
>   <th>fid</th>
>     <th >GRAY_INDEX</th>
>   </tr>
> 
>     <tr>
> 
>   <td></td>    
>       <td>1558.0</td>
> 
>   </tr>
> </table>
> <br/>
> 
>   </body>
> </html>
> 
> Any ideas, comments ware welcome,
> 
> Kris


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.


More information about the Users mailing list