I have been trying to figure out how to send a filter to geoserver using wfs.
The filter that I want to send is:
filterXML = '<Filter>'+
'<Crosses>'+
'<PropertyName>the_geom</PropertyName>'+
'<Function name="collectGeometries">'+
'<Function name="queryCollection">'+
'<Literal>tasmania_water_bodies</Literal>'+
'<Literal>the_geom</Literal>'+
'<Literal>AREA = 1064866676</Literal>'+
'</Function>'+
'</Function>'+
'</Crosses>'+
'</Filter>';
I have a WFS protocol and i would like to attach that filter with this request:
wfsProtocol = new OpenLayers.Protocol.WFS({
url: "http://localhost:8080/geoserver/wfs",
featureType: ["tasmania_water_bodies"],
featureNS: "http://www.openplans.org/topp"
});
wfsLayer = new OpenLayers.Layer.Vector("LinesWFS", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: wfsProtocol
});
I have tried converting it to a filter using this:
parser = new OpenLayers.Format.Filter.v1_1_0 ();
xml = new OpenLayers.Format.XML();
my_filter_xml = fil; //your filter string
var x = xml.read(my_filter_xml).documentElement
var filter1 = parser.read(x);
console.log(filter1)
That works for very basic xml filters, but not the one that I want to convert.
Am I doing it the wrong way?