[OpenLayers-Users] How to issue custom WFS request in 2.8

Balázs Bámer bamerbalazs at gmail.com
Sat Dec 12 11:52:42 EST 2009


HI All,

I try to issue custom WFS 1.0.0 GetFeature request (could be also
1.1.0, doesn't matter). Goal is to count some attributes (or list them
later). However, there is always some error, now

"An attempt was made to create or change an object in a way which is
incorrect with regard to namespaces" code: "14
[Break on this error] node.setAttributeNS(uri, name, value);\n"

What is the correct way to do this in OpenLayers 2.8? Something
similar worked in 2.7 but I need 2.8.

thank you in advance, best regards: Balázs Bámer

I do the following:


        filter=new OpenLayers.Filter.Comparison({
            type: OpenLayers.Filter.Comparison.EQUAL_TO,
            property: "bloaz",
            value: kerespanel.findById('bloazid').value
        });
        format = new OpenLayers.Format.WFST.v1_0_0({
            featureNS: 'blokknezegeto',
            featurePrefix: 'blokknezegeto',
            namespaces: {
                "wfs": "http://www.opengis.net/wfs",
                "ogc": "http://www.opengis.net/ogc"
            }
        });
        wfs = new OpenLayers.Protocol.WFS.v1_0_0({
            url:
"http://att-it.homelinux.net:22080/cgi-bin/ms-5.4.2/blokknez.fcgi",
            params: {
                filter: filter,
                maxFeatures: 200,
                srsName: "EPSG:23700",
                typeName: "blokk2009"
            },
            format: format,
            typename: "blokk2009",
            featureType: "blokk2009",
            featureNS: "blokknezegeto",
            feturePrefix: "blokknezegeto",
            geometryName: "bgeom"
        });
        wfs.read({
            callback: function(result) {
                var gml = result.features;
                n=0;
                for(i in gml) {
                    egyik=gml[i];

document.getElementById("eredmeny").innerHTML="Blokk azonosito:
"+egyik.attributes.BLOAZ+"<br>terulet (ha):
"+egyik.attributes.BPTERHA;
                    n++;
                }
                alert("ennyit talaltam: "+n);
            }/*,
            scope: this*/
        });



More information about the Users mailing list