I am having a problem getting the results back from a WMSGetFeatureInfo call to my GeoServer. Using OpenLayers 2.12, GeoServer 2.4.0, Windows Server2008, and Microsoft IIS 7.5 with Application Request Routing Cache and URL Rewrite. I do NOT use a proxy because I use URL Rewrite. The URL Rewrite takes my incoming requests and formats them to avoid the cross domain/same origin problem.
I have been successfully querying WFS data using this setup for 2 years but when I try to use the WMSGetFeatureInfo it fails.
Here is my process:
- I serve multiple WMS layers from GeoServer to my web page.
- The user selects a WMS layer from a dropdown. This sets the variable "selLayer" so my WMSGetFeatureInfo call is pointing at the layer the user wants to get information about.
- When the user clicks on the layer it fires this code which creates a OpenLayers WMSGetFeatureInfo control with an event listener that should accept the return text & xmlHttp request and display them in a div. :
var infoControl = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://xx.xx.xx.xx:8080/geoserver/wms',
title: 'Identify features by clicking',
layers: [selLayer],
queryVisible: true,
//eventListeners: { getfeatureinfo: function (event) { alert("TEXT: " + event.text + ", XY: " + event.xy + ", REQUEST" + event.request + ", FEATURES: " + event.features); } }
eventListeners: { getfeatureinfo: function (event) {
document.getElementById("divAttributes").innerHTML = event.text + "Test Text";
alert("PUT TEXT HERE!!!");
}
}
});
map.addControl(infoControl);
infoControl.activate();
But, when the script runs I do not get return values for the event.text. When I run this in FireFox (with FireBug) I can copy the GetFeatureInfo request into a new browser window and I get the desired return values.
So my question is: Why am I not getting the return values when I run this on my map webpage but I do get results by posting the request into a new browser window.
event.textis not as expected but you don't say whether the event object itself has anything else from the server – tomfumb Nov 09 '13 at 00:18