[OpenLayers-Dev] this.callbacks is undefined error

Sunder Raj Abbai Naidoo SunderRajA at sita.co.za
Thu Mar 12 07:39:55 EDT 2009


Good Day Everyone

 

I want to make use of the GetFeatureInfo functionality, but I want to do
so by clicking a button on the map panel. Below is the coding that I am
using. I click on the button and when I click on a feature point I get
the following error displayed below in firebug. FYI, I am using
OpenLayers 2.7. Can someone please help me with this?

 

ERROR:

this.callbacks is undefined

OpenLayers.js (line 662)

 

SOURCE CODE:

 var featureInfo;

 

 // build the featureInfo (aka query tool/button)

 featureInfo = new OpenLayers.Control(

                  {title: "Query map features", 

                   displayClass: "olControlFeatureInfo"});

                

 // register events to the featureInfo tool

 featureInfo.events.register("activate", featureInfo, function() {
toggleQueryMode(); });                

 featureInfo.events.register("deactivate", featureInfo, function() {
toggleQueryMode(); });

 

panel.addControls([featureInfo]);

 

 // support GetFeatureInfo

 queryEventHandler = new OpenLayers.Handler.Click({'map': map, 'click':
function(e) { doGetFeatureInfo(e); } });

 

 

 function toggleQueryMode() {             

   if(featureInfo.active) {

      queryEventHandler.activate();

    } else {

         queryEventHandler.deactivate();

   }

 }

        

 function doGetFeatureInfo(e) {

   document.getElementById('nodelist').innerHTML = "Loading... please
wait...";

   var url =  map.layers[0].getFullRequestString(

             {REQUEST: "GetFeatureInfo",

              EXCEPTIONS: "application/vnd.ogc.se_xml",

              BBOX: map.getExtent().toBBOX(),

              X: e.xy.x,

              Y: e.xy.y,

              INFO_FORMAT: 'text/html',

              QUERY_LAYERS: map.layers[0].params.LAYERS,

              FEATURE_COUNT: 50,

              WIDTH: map.size.w,

              HEIGHT: map.size.h},

              "http://10.128.78.27:8080/geoserver/gwc/service/wms");

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

   OpenLayers.Event.stop(e);

 }

 

Thanks

Raj.

 

 


.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20090312/6b5b91ba/attachment.html


More information about the Dev mailing list