[Users] WMSGetFeatureInfo

Gaston Lucero gaston.lucerom at gmail.com
Wed Jan 9 20:14:37 CET 2013


Hi, i have this problem, i want to show a popup with feature info, but in
method getfeatureinfo, the attribute event.features is empty.
in the code below
with info variable  the popup works
with info2 variable the popup is empty
I use geoext2, ext 4.1, OL 2.12

Ext.define("MP.view.MapPanel", {
    extend: "GeoExt.panel.Map",

 initComponent: function() {
        this.map = new OpenLayers.Map('map',
                {
                    projection: 'EPSG:3857',
                    numZoomLevels: 20,
                    allOverlays: true,
                    controls: [
        new OpenLayers.Control.Navigation({
            dragPanOptions: {
                enableKinetic: true
            }
        }),
        new OpenLayers.Control.Attribution(),
        new OpenLayers.Control.Zoom()
    ]
                });

        var wms_layer = new OpenLayers.Layer.WMS("Global Imagery",
                "http://172.16.102.42:8080/geoserver/sf/wms",
                {
                       layers : "sf:Cuencas superficiales"
                },
                {
                    isBaseLayer:true
                }, {
            buffer: 0,
            visibility: true
        }
        );

        this.map.addLayer(wms_layer);


var info = new OpenLayers.Control.WMSGetFeatureInfo({
            title: 'Identify features by clicking',
             //maxFeatures: 10,
             infoFormat: "text/html",
              layers: [wms_layer],
            queryVisible: true,
            eventListeners: {
                getfeatureinfo: function(event) {
                    this.map.addPopup(new OpenLayers.Popup.FramedCloud(
                        "chicken",
                        this.map.getLonLatFromPixel(event.xy),
                        null,
                        event.text,
                        null,
                        true
                    ));
                }
            }
        });

var info2 = new OpenLayers.Control.WMSGetFeatureInfo({
    autoActivate: true,
    infoFormat: "application/vnd.ogc.gml",
    layers: [wms_layer],
    eventListeners: {
          getfeatureinfo: function(event) {
            var items = [];
            Ext.each(event.features, function(feature) {
                items.push({
                   xtype: "propertygrid",
                    title: feature.fid,
                    source: feature.attributes
                });
            });

            Ext.create("GeoExt.window.Popup",{
                title: "Feature Info",
                width: 200,
                height: 200,
                layout: "accordion",
                map: this.map,
                location: event.xy,
                items: items
            }).show();
        }
    }
});
 //this.map.addControl(info);
 //info.activate();

    this.map.addControl(info2);
     info2.activate();
        this.callParent();
    }
}

thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20130109/7933bb2d/attachment.htm 


More information about the Users mailing list