Hi, first of all, please don't cross-post to dev and users if it is not necessary.
Maybe you can check out the following for pointers: http://dev.openlayers.org/sandbox/bartvde/wmsgetfeatureinfo/openlayers/lib/OpenLayers/Control/FeatureInfo.js http://dev.openlayers.org/sandbox/bartvde/wmsgetfeatureinfo/openlayers/examples/featureinfo-control.html Best regards, Bart > 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. > > > > > > > . > _______________________________________________ > Dev mailing list > Dev@openlayers.org > http://openlayers.org/mailman/listinfo/dev > _______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev