1

I have a problem with my application and more precisely the pop up that appears empty.

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: "Feature Info",
                width: 200,
                height: 200,
                layout: "accordion",
                map: app.mapPanel,
                location: e.xy,
                items: items
            }).show();
        }
    }
}));

empty popup

3
  • sorry @BORUSSEN11 When I added code block to your question the image fell out somehow. Can you add it back?
    – Brad Nesom
    Commented Jun 18, 2015 at 13:26
  • Have you checked with debug tools if there is a repsonse coming back from Geoserver? you could also use console.log to test that: "getfeatureinfo": function(e) {console.log(e.features); ......
    – Thomas B
    Commented Jun 19, 2015 at 13:06
  • @Brad Nesom just fixed the formatting, so that the image is visible again ;)
    – Thomas B
    Commented Jun 19, 2015 at 14:39

1 Answer 1

2

A common reason for such an error is the Same-Origin-Policy.

If your Webserver is serving on Port 80 and Geoserver on Port 8080 for example then your request can be blocked because of a violation of the Same Origin Policy.

enter image description here

If that's the reason in your case just add a proxy.cgi, adapt it to your needs (correct settings/path for the python shebang, add your geoserver url to the allowed hosts) and set the OL-ProxyHost:

OpenLayers.ProxyHost="/cgi-bin/proxy.cgi?url=";

https://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Then it should work: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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