[Users] GetFeature popup shows attributes of deactivated layers??

Robert Buckley robertdbuckley at yahoo.com
Tue Sep 21 17:48:50 CEST 2010


Hi.

My Popup shows the attributes of all the layers in the map even when they are 
not visible.

I would like to see only the attributes of the layers which are visible, and 
also to decide which columns will be displayed.

Is there an easy standard way of doing this?

Thanks for any help,

Robert Buckley




CODE:

// create the popup
var featureInfo = new OpenLayers.Control.WMSGetFeatureInfo();
featureInfo.events.on({
    getfeatureinfo: function(e) {
        new GeoExt.Popup({
            title: "Feature Info",
            width: 200,
            height: 450,
            bodyStyle: 'padding: 30px; 
background-color:beige;color:blue;font-size:14px;',
            autoScroll: true,
            maximizable: true,
            map: mapPanel.map,
            lonlat: mapPanel.map.getLonLatFromPixel(e.xy),
            html: e.text,
            anchored: true,
            listeners: {
                    close: function() {
                        // closing a popup destroys it, but our reference is 
truthy
                        popup = null;
                    }
                }

        }).show();
    }
});

map.addControl(featureInfo);

featureInfo.activate();    





More information about the Users mailing list