I have two OGC filters client side:
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo matchCase="true">
<ogc:PropertyName>code</ogc:PropertyName>
<ogc:Literal>secret</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:Intersects>
<ogc:PropertyName>geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml">
<gml:coordinates decimal="." cs="," ts=" ">1298543.0367787,7107400.531374 1299312.4070614,7203464.9016567</gml:coordinates>
</gml:Box>
</ogc:Intersects>
</ogc:Filter>
I have both filters represented as strings and I want to combine them into one filter. I can see in the documentation that OpenLayers can create a Filter Object from a string, but it doesn't seem to work for me.
Am I doing something wrong and/or how should I do it?
Best Answer
To read a filter from a string should look something like:
This should return you an OpenLayers.Filter object. Do this for both your filters so you have two filter objects.
Finally create a new "parent" filter (which can be AND, OR, etc.) which combines the two: