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.

I got the GeoExt QueryPanel working so far, it recognizes the layers available on my Geoserver but it is not able to get the attribute columns for the dataset. I configured an osgeo proxy on my Apache Server, I use the override-ext-ajax.js and have the OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; class configured.

A DescribeFeatureType request is sent when selecting the layer I want to filter. The same happens when trying to choose the attribute column in the query panel, but there are none displayed.

The sent request URLs look like this:

http://localhost/cgi-bin/proxy.cgi?url=
http%3A%2F%2Flocalhost%2Fcgibin%2Fproxy.cgi%2Fwfs%3F
VERSION%3D1.1.0%26REQUEST%3DDescribeFeatureType%26TYPENAME%3Dcases%26query%3D

The strange part here is, that the request is sent via the proxy.cgi twice. The request URL should look like this, going passed geoserver´s WFS:

http://localhost/cgi-bin/proxy.cgi?url=
http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fwfs%3F
VERSION%3D1.1.0%26REQUEST%3DDescribeFeatureType%26TYPENAME%3Dcases%26query%3D

Does anybody have a clue what´s going wrong here and why the request URL is wrong? The strange thing is that even if I remove the Open.Layers.ProxyHost class and the override-ext-ajax.js from my application, the request is sent that way. This leads to the conclusion, that the source of error can be found in the QueryPanel.js file, yet I couldn´t spot it.
Can it, on the other hand be related to my server? Other requests sent in the application (GET & POST) work fine. The (relevant) code looks like this, maybe you guys can spot the error...

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

var owsUrl = "/geoserver/wfs";

var symbolizer = OpenLayers.Feature.Vector.style["default"];

symbolizer.graphicName = "square";

var store;

Ext.onReady(function() {

            store = new GeoExt.data.WFSCapabilitiesStore({
            url: Ext.urlAppend(owsUrl,
               "VERSION=1.0.0&REQUEST=GetCapabilities"),
            protocolOptions: {version: "1.1.0"},
            autoLoad: true,
            listeners: {
                load: initApp
            }
            });
        });   

function initApp() {
        var vecLayer = new OpenLayers.Layer.Vector("Query", {
            eventListeners: {
                featuresadded: function() {
                    var extent = vecLayer.getDataExtent()
                    mapPanel.map.zoomToExtent(extent)
                }
            }
        });   



 var queryPanel = new gxp.QueryPanel({
            title: "Query",
            region: "center",
            width: 350,
            bodyStyle: "padding: 10px",
            autoScroll: true,
            layerStore: store,
            bbar: ["->", {
                text: "Query",
                handler: function() {
                    queryPanel.query();
                }
            }],
            listeners: {
                query: function(panel, store) {
                    var rule = new OpenLayers.Rule({
                        filter: panel.getFilter()
                    });
                    rule.symbolizer[queryPanel.symbolizerType] = symbolizer;
                    var style = new OpenLayers.Style("", {rules: [rule]});
                    wms.mergeNewParams({
                        sld_body: new OpenLayers.Format.SLD().write({
                            namedLayers: [{
                                name: panel.selectedLayer.get("name"),
                                userStyles: [style]
                            }]
                        })
                    });

                    store.bind(vecLayer, {
                        initDir: GeoExt.data.FeatureStore.STORE_TO_LAYER
                    });
                }
            }
        });

Any help is appreciated!

Cheers,

Philippe

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

I figured the problem - think it was a setting that I made when having difficulties configuring a WFS. In GeoServer Globale settings, I set the Proxy Base URL to http://localhost/cgi-bin/proxy.cgi?url=

Sorry for any confusion!

share|improve this answer
add comment

At a quick glance I'd imagine the issue is around the lines below:

181         var protocol = record.get("layer").protocol;
182         this.attributeStore = new GeoExt.data.AttributeStore({
183             url: Ext.urlAppend(protocol.url, Ext.urlEncode({
184                 "VERSION": protocol.version,
185                 "REQUEST": "DescribeFeatureType",
186                 "TYPENAME": record.get("name")
187             })),

The tricky part will be debugging. To find out exactly what is happening, I'd make sure you set up the following:

  1. Use the full source code, not a minified version, so you can debug it more easily
  2. Use Firebug in FireFox
  3. Put a debugger line just before the code above. The code will stop at this point and you can check the url values, and where they are coming from.
share|improve this answer
    
It was indeed line 182 that created the wrong URL. When using firebug, I can temporarily change the URLs and make the queries work. Replacing line 182 with url: Ext.urlAppend("http://localhost/geoserver/wfs", Ext.urlEncode({, I can access the attribute names but queries are still sent via the proxy URL. Is there a way to change the URLs created by the QueryPanel.js permanently? If not, is there another way of fixing this problem? –  philippe Oct 4 '11 at 16:18
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.