[OpenLayers-Users] Handling of empty getFeatureInfoResults

Kai Behncke Kai-Behncke at gmx.de
Mon Feb 23 11:32:51 EST 2009


Dear list,


I have got a question to the handling of "empty" getfeatureinfo-results.


The "core" of getfeatureinfo.html (in the examples) is:

            var url =  wms.getFullRequestString({
                            REQUEST: "GetFeatureInfo",
                            EXCEPTIONS: "application/vnd.ogc.se_xml",
                            BBOX: wms.map.getExtent().toBBOX(),
                            X: e.xy.x,
                            Y: e.xy.y,
                            INFO_FORMAT: 'text/html',
                            QUERY_LAYERS: wms.params.LAYERS,
                            WIDTH: wms.map.size.w,
                            HEIGHT: wms.map.size.h});
            OpenLayers.loadURL(url, '', this, setHTML);
            OpenLayers.Event.stop(e);
      });
    function setHTML(response) {
        OpenLayers.Util.getElement('nodeList').innerHTML = response.responseText;
    }


It works nice if I click on an existing wms-point.

I wonder how to handle a empty "non-existing-response" (that comes if I click beside a wms-point).

I try to write a function (new_window(url)) that opens a new window with an entry "You clicked besides the point" (or, if not, the result of the wms-point).

like :

 	   function setHTML(response,url) {
 	//"non existing response" -> click besides a point
 	if (response.responseText.length==1) {
 
 	  url='http://noresult_url';
         new_window(url);
 	 } 
//response -> click on a point
else 
{
    new_window(url);
}
}  


But the problem is: I don`t get it to transport the url to the function "setHTML", so that setHTML works with that ajax-response AND(!) the url.

Has anybody an idea how to solve/handle that?

Thank you very much, Kai
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01



More information about the Users mailing list