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.

GeoExt info Popup is very easy to use but when one or more layer is missing or fails to load Avoiding Pink Tyles. The popup is not filled with the values. While I can see that request is sent to the server and response is there but popup is blank. Is there any way to handle this condition without building custom component?

OpenLayers.Util.onImageLoadErrorColor = 1;
            OpenLayers.Util.onImageLoadErrorColor = "transparent";  
            OpenLayers.Util.onImageLoadError = function(){
                 this.src = "/img/blank.gif";
            };

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

                        new GeoExt.Popup({
                            title: "Info",
                            width: 200,
                            height: 200,
                            layout: "accordion",
                            map: app.mapPanel,
                            location: e.xy,
                            maximizable: true,
                            collapsible: true,
                            items: items 
                        }).show();                      

                    }
                }
            }));
share|improve this question
1  
sample code please. –  CaptDragon Mar 1 '12 at 14:06
    
@CaptDragon Edited the question –  kinkajou Mar 2 '12 at 3:48
add comment

2 Answers

Try placing a condition to check to see if there are results first. if (e.features.length > 0){

like:

"getfeatureinfo": function(e) {  
    if (e.features.length > 0){ //<-- add this if statement
        var items = [];
        Ext.each(e.features, function(feature) {
        ...
        });

        new GeoExt.Popup({
        ...
        }).show();                      
    }
}  
share|improve this answer
add comment

I think the problem isn't with the popup but with the get feature info request. You need to control if the request is made right, if so show the popup and if there was any error not show the popup or show a message error.

share|improve this answer
    
the firebug doesn't show any error. There is get request for all layers including layer that is not loaded. –  kinkajou Mar 2 '12 at 3:49
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.