Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm making a simple GetFeatureInfo request against a GeoServer WMS, but it returns empty responses. The request utility I'm using is OpenLayers.loadURL.

The funny thing is, I can paste the generated request URL from FireBug into a new browser tab and get a valid response. So, it seems to be something with the OpenLayers.loadURL. See the examples below.

I can get a valid response with this map event where the GetFeatureInfo request is in a new window:'click', map, function (e) {
    var url = "http://localhost:8080/geoserver/MYLAYER/wms" 
    var params = "" 
      + "REQUEST=GetFeatureInfo"
      + "&SERVICE=WMS"
      + "&EXCEPTIONS=application/vnd.ogc.se_xml"
      + "&VERSION=1.1.1"
      + "&BBOX=" + map.getExtent().toBBOX()
      + "&X=" + Math.round(e.xy.x)
      + "&Y=" + Math.round(e.xy.y)
      + "&INFO_FORMAT=text/html"
      + "&QUERY_LAYERS=NERD:NERD Risk Rates"
      + "&LAYERS=NERD:NERD Risk Rates"
      + "&FEATURE_COUNT=50"
      + "&format=image/png"
      + "&SRS=EPSG:900913"
      + "&STYLES="
      + "&WIDTH=" + map.size.w
      + "&HEIGHT=" + map.size.h;



However, this map event using OpenLayers.loadURL always returns an empty response and no error. But if I cut and paste the GET request url from FireBug into a new browser window, I get the proper response:'click', map, function (e) {
    var url = "http://localhost:8080/geoserver/MYLAYER/wms" 

    var paramHash =  {
      REQUEST : "GetFeatureInfo" ,
      EXCEPTIONS : "application/vnd.ogc.se_xml" ,
      SERVICE : "WMS" , 
      VERSION : "1.1.1" ,
      BBOX : map.getExtent().toBBOX() ,
      X : Math.round(e.xy.x) ,
      Y : Math.round(e.xy.y) ,
      INFO_FORMAT : "text/html" , 
      QUERY_LAYERS : "NERD:NERD Risk Rates" , 
      LAYERS : "NERD:NERD Risk Rates" ,
      FEATURE_COUNT : 50 , 
      format : "image/png" ,
      srs : "EPSG:900913" ,
      styles : "" ,
      WIDTH : map.size.w , 
      HEIGHT : map.size.h

    OpenLayers.loadURL(url, paramHash, this, setHTML, setHTML);


Someone have any ideas?

share|improve this question
up vote 3 down vote accepted

Sounds like a same origin problem to me. Are you serving your page from a different host/port combination than the map server? See for details of how to fix this using a proxy or move your html page to data/web in your geoserver installation.

share|improve this answer
Yes, you are correct. So now I'm trying to serve my static html page out of apache-tomcat geoserver project as described here There is already html in the directory /var/lib/tomcat6/webapps/geoserver/data/www such as ol-demo.html. I can see this html if i go to localhost:8080/geoserver/www/ol-demo.html. But if i stick my html in this directory and try to go to the URL I only get a 404? Any ideas about that? – maztaz Feb 1 '12 at 12:22
/usr/share/opengeo-suite-data not the actual tomcat directory. ugh – maztaz Feb 1 '12 at 12:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.