[OpenLayers-Users] GetFeatureInfo

Nina Helle-Mildt helle at sdac.hannover.bgr.de
Thu Nov 13 06:20:19 EST 2008


Hi there,

just in case of interest - that's the way I succeeded to query different 
WMS in my application.  There is just one restraint: The last response 
(GetFeatureInfo) will overwrite earlier ones. (In my case that doesn't 
matter ...)

Regards
Nina

//Support GetFeatureInfo querying different WMS

var format = 'text/html';
//var format = 'text/plain';
var datalist = new Array(seis_ger, seis);
		 				
map.events.register('click', map, function (e) {
   OpenLayers.Util.getElement('nodeList').innerHTML = " ";
					
   for (var i = 0; i < datalist.length; i++) {
	var dlist = datalist[i];
	url = dlist.getFullRequestString({
                 REQUEST: "GetFeatureInfo",
                 EXCEPTIONS: "application/vnd.ogc.se_xml",
                 BBOX: dlist.map.getExtent().toBBOX(),
                 X: e.xy.x,
                 Y: e.xy.y,
		INFO_FORMAT: format,
                 QUERY_LAYERS: dlist.params.LAYERS,
                 WIDTH: dlist.map.size.w,
                 HEIGHT: dlist.map.size.h});

	OpenLayers.loadURL(url, '', this, setHTML);
         OpenLayers.Event.stop(e);
   }
});

function setHTML(response) {
   var res = response.responseText;
   if (res.length > 1 && res.indexOf('no results') == -1) {
	OpenLayers.Util.getElement('nodeList').innerHTML = res;
   }
}





More information about the Users mailing list