Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to get attributes of feature using getFeatureInfo:

if(sss==null){
   if (sld==null){
     sld= new OpenLayers.Control.WMSGetFeatureInfo({
    url: 'http://localhost:8080/geoserver/wms', 
    title: 'Identify',
    layers: myLayer,
    queryVisible: true
     });
   app.mapPanel.map.addControl(sld);
   sss=app.mapPanel.map.getControlsBy('title', 'Identify');
}                                   
}
for(var i=0;i<sss.length;i++){
alert("BROMACIA");
 sss[i].activate();
}
sss[0].events.register("getfeatureinfo", app.mapPanel.map, function showInfo(evt) {
alert(evt.text)});

And nothing heppens.
When i try to do in firebug:

>>> sss[0].events.register("getfeatureinfo", app.mapPanel.map, function showInfo(evt) { alert(evt.text)});

firebug says undifined.

Whats wrong?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Solution:

if(sss==null){
if (sld==null){
 sld= new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/wms', 
title: 'Identify',
layers: myLayer,
queryVisible: true
 });
app.mapPanel.map.addControl(sld);
sss=app.mapPanel.map.getControlsBy('title', 'Identify');
}                                   
}
function showInfo(evt) {
lert(evt.text);
}
for(var i=0;i<sss.length;i++){
  alert("BROMACIA");
  sss[i].activate();
  sss[i].events.register("getfeatureinfo", app.mapPanel.map, showInfo);
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.