0

I installed Apache2 and GeoServer, then set up the proxy.cgi. I imported shapefile based multipolygon file into GeoServer. I can access this via the GeoServer OpenLayers viewer but when I want to do the same in an HTML file I can't do it, because the GetFeatureInfo doesn't want to work properly.

I added to the file:

OpenLayers.ProxyHost = "proxy.cgi?url=";
map.events.register('click', map, function (e) {
                    document.getElementById('nodelist').innerHTML = "Loading... please wait...";
                    var params = {
                        REQUEST: "GetFeatureInfo",
                        EXCEPTIONS: "application/vnd.ogc.se_xml",
                        BBOX: map.getExtent().toBBOX(),
                        SERVICE: "WMS",
                        INFO_FORMAT: 'text/html',
                        QUERY_LAYERS: map.layers[0].params.LAYERS,
                        FEATURE_COUNT: 50,
                        Layers: 'csongrad_demo:csongmat',
                        WIDTH: map.size.w,
                        HEIGHT: map.size.h,
                        format: format,
                        styles: map.layers[0].params.STYLES,
                        srs: map.layers[0].params.SRS};


                    OpenLayers.loadURL("http://xxx.xxx.xxx.xxx:80/geoserver/csongrad_demo/wms", params, this, setHTML, setHTML);
                    OpenLayers.Event.stop(e);
                }); 

Then I tried this:

info = new OpenLayers.Control.WMSGetFeatureInfo({
                    url: 'http://xx.xx.xx.xx:80/geoserver/wms', 
                    layerUrls: 'http://xx.xx.xx.xx:80/geoserver/csongrad_demo/wms',
                    title: 'Identify features by clicking',
                    queryVisible: true,
                    eventListeners: {
                        getfeatureinfo: function(event) {
                            map.addPopup(new OpenLayers.Popup.FramedCloud(
                                "chicken", 
                                map.getLonLatFromPixel(event.xy),
                                null,
                                event.text,
                                null,
                                true
                            ));
                        }
                    }
                });
                info.activate();
                map.addControl(info);

None of them wanted to work, I always get this error "Loading... please wait..."

  • Do you see a request being sent in Firebug? Is the proxy.cgi configured properly? – Devdatta Tengshe Mar 7 '14 at 16:15
  • When I submit localhost/cgi-bin/proxy.cgi I can see the openlayers front page – Balazs Mar 7 '14 at 16:24
  • Are you sure geoserver is running on port 80? Isn't it 8080? – Michal Zimmermann Mar 7 '14 at 17:48
  • Im totally sure, because I redirect to port 80 with apache2 proxy, and its working I can see the map but getfeatureinfo doesnt want to work.... – Balazs Mar 7 '14 at 17:52
  • What do you see in Firebug? What if you ty without port number? How does your proxy.cgi look like? – Michal Zimmermann Mar 7 '14 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.