Hi
I suspect the XML filter must actually be a valid XML block. Passing the BBOX values in the URI isn't the same thing as an XML filter function, so it behaves differently.
Would it be possible for you to modify the URL so that the BBOX values gets included there? I suspect this is also more efficient for the WFS server.
David
Heya David, that is exactly what I want to do but I do not know how. I can built and send the request with HTTPCaller but I do not know how to proces the response like the WFS reader does...
Hi,
You can try the following in the filter tag:
<ogc:Filter xmlns:ogc="
http://www.opengis.net/ogc" xmlns:gml="
http://www.opengis.net/gml" xmlns:wfs="
http://www.opengis.net/wfs">
<ogc:Overlaps>
<ogc:PropertyName>geom</ogc:PropertyName>
<gml:Polygon srsName="EPSG:28992">
<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>168649.196,446969.785671 168649.196,454456.416678 184608.68,454456.416678 184608.68,446969.785671 168649.196,446969.785671
</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Overlaps>
</ogc:Filter>
Works on PDOK.
Hi again,
You can also just specify a bbox in the WFS reader parameters instead of the filter.
Heya Itay, the latter works indeed but then I need to enter the bbox coordinates by hand and being lazy and determined this should work...
The only simple thing I want is read features, determining boundingboxes, request the WFS with this boundingboxes and get points with attributes within the boudingboxes in return.
It should not be so hard but every time I want to do something the WFS reader can not do for me out of the box I tumble in this depressing XML / GML hole with allmost no positive results.
Hi Niels,
Pay close attention to the request result of the WFS reader when using the bbox filter, you can then use the request in a HTTPCaller adjusting the bbox coords to your calculated bboxses.
After that its a simple matter of using the GeometryReplacer to get the objects out of the responce XML.
Itay, the GeometryReplacer was my missing link in the HTTPCaller alternative. Thanks a million, learned a lot.
I have also struggled to find some proper documentation for the XML filter in the WFS reader.
For those interested, on the forum there are quite some related questions on this topic, e.g.:
Furthermore some more info on the topic of XML filters within WFS GetFeature requests, including some elegant examples can be found at:
From this search on the topic it seems like there are many ways to set up (a bounding box) XML filter for use within the WFS reader. E.g. The fourth link of the knowledge center hints towards the following XML filter to specify a bounding box:
<Filter>
<Within>
<PropertyName>geometry</PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>89800,455000 99200,455000 99200,469000 89800,469000 89800,455000</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Within>
</Filter>
On https://mapserver.org/ogc/filter_encoding.html the following example is given to specify a bounding box in an XML filter:
<Filter>
<BBOX>
<PropertyName>Name>NAME</PropertyName>
<Box%20srsName='EPSG:42304'>
<coordinates>135.2239,34.4879 135.8578,34.8471</coordinates>
</Box>
</BBOX>
</Filter>
Finally the OGC Filter Encoding 2.0 specificaton also provide some nice examples of XML filter examples (starting from page 64 of that document, c.q. page 70 of the PDF). Example 4 of this document describes the following XML filter to specify a bounding box (where I omitted the namespace declarations):
<Filter>
<BBOX>
<ValueReference>Geometry</ValueReference>
<Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<lowerCorner>13.0983 31.5899</lowerCorner>
<upperCorner>35.5472 42.8143</upperCorner>
</Envelope>
</BBOX>
</Filter>
Extending from the BBOX examples, here are some initial observations from me on XML filters within the WFS reader:
- It seems that a 'namespace declaration' is not always required for the 'nodes' within the XML filter expression of FME. I'm not sure if this is never needed.
- Quite many of the examples on the forum for XML filters focus on 'attribute queries' that use the XML node 'PropertyName'. The first example from the OGC Filter Encoding 2.0 specificaton seems to use the XML node 'ValueReference' instead. In one of my workspaces I came across the situation that using the XML node 'PropertyName' didn't query out the required data, while using the ~similar (?) XML node 'ValueReference' did query out the desired data.
The example to the latter bullit was as follows. The following XML filter failed to query out the data:
<Filter>
<PropertyIsEqualTo>
<PropertyName>code</PropertyName>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
While the following XML filter did query out the data.
<Filter>
<PropertyIsEqualTo>
<ValueReference>code</ValueReference>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
Please note that the first type of query did work for me in most other cases (I think the problem arises from the number starting with a 0). I'm also not sure if the XML node 'ValueReference' can be used for all WFS versions (i.e. it might be only valid for WFS version 2.0)
I have also struggled to find some proper documentation for the XML filter in the WFS reader.
For those interested, on the forum there are quite some related questions on this topic, e.g.:
Furthermore some more info on the topic of XML filters within WFS GetFeature requests, including some elegant examples can be found at:
From this search on the topic it seems like there are many ways to set up (a bounding box) XML filter for use within the WFS reader. E.g. The fourth link of the knowledge center hints towards the following XML filter to specify a bounding box:
<Filter>
<Within>
<PropertyName>geometry</PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>89800,455000 99200,455000 99200,469000 89800,469000 89800,455000</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Within>
</Filter>
On https://mapserver.org/ogc/filter_encoding.html the following example is given to specify a bounding box in an XML filter:
<Filter>
<BBOX>
<PropertyName>Name>NAME</PropertyName>
<Box%20srsName='EPSG:42304'>
<coordinates>135.2239,34.4879 135.8578,34.8471</coordinates>
</Box>
</BBOX>
</Filter>
Finally the OGC Filter Encoding 2.0 specificaton also provide some nice examples of XML filter examples (starting from page 64 of that document, c.q. page 70 of the PDF). Example 4 of this document describes the following XML filter to specify a bounding box (where I omitted the namespace declarations):
<Filter>
<BBOX>
<ValueReference>Geometry</ValueReference>
<Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<lowerCorner>13.0983 31.5899</lowerCorner>
<upperCorner>35.5472 42.8143</upperCorner>
</Envelope>
</BBOX>
</Filter>
Extending from the BBOX examples, here are some initial observations from me on XML filters within the WFS reader:
- It seems that a 'namespace declaration' is not always required for the 'nodes' within the XML filter expression of FME. I'm not sure if this is never needed.
- Quite many of the examples on the forum for XML filters focus on 'attribute queries' that use the XML node 'PropertyName'. The first example from the OGC Filter Encoding 2.0 specificaton seems to use the XML node 'ValueReference' instead. In one of my workspaces I came across the situation that using the XML node 'PropertyName' didn't query out the required data, while using the ~similar (?) XML node 'ValueReference' did query out the desired data.
The example to the latter bullit was as follows. The following XML filter failed to query out the data:
<Filter>
<PropertyIsEqualTo>
<PropertyName>code</PropertyName>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
While the following XML filter did query out the data.
<Filter>
<PropertyIsEqualTo>
<ValueReference>code</ValueReference>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
Please note that the first type of query did work for me in most other cases (I think the problem arises from the number starting with a 0). I'm also not sure if the XML node 'ValueReference' can be used for all WFS versions (i.e. it might be only valid for WFS version 2.0)
@thijsknapen Great info, thanks
I have also struggled to find some proper documentation for the XML filter in the WFS reader.
For those interested, on the forum there are quite some related questions on this topic, e.g.:
Furthermore some more info on the topic of XML filters within WFS GetFeature requests, including some elegant examples can be found at:
From this search on the topic it seems like there are many ways to set up (a bounding box) XML filter for use within the WFS reader. E.g. The fourth link of the knowledge center hints towards the following XML filter to specify a bounding box:
<Filter>
<Within>
<PropertyName>geometry</PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>89800,455000 99200,455000 99200,469000 89800,469000 89800,455000</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Within>
</Filter>
On https://mapserver.org/ogc/filter_encoding.html the following example is given to specify a bounding box in an XML filter:
<Filter>
<BBOX>
<PropertyName>Name>NAME</PropertyName>
<Box%20srsName='EPSG:42304'>
<coordinates>135.2239,34.4879 135.8578,34.8471</coordinates>
</Box>
</BBOX>
</Filter>
Finally the OGC Filter Encoding 2.0 specificaton also provide some nice examples of XML filter examples (starting from page 64 of that document, c.q. page 70 of the PDF). Example 4 of this document describes the following XML filter to specify a bounding box (where I omitted the namespace declarations):
<Filter>
<BBOX>
<ValueReference>Geometry</ValueReference>
<Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<lowerCorner>13.0983 31.5899</lowerCorner>
<upperCorner>35.5472 42.8143</upperCorner>
</Envelope>
</BBOX>
</Filter>
Extending from the BBOX examples, here are some initial observations from me on XML filters within the WFS reader:
- It seems that a 'namespace declaration' is not always required for the 'nodes' within the XML filter expression of FME. I'm not sure if this is never needed.
- Quite many of the examples on the forum for XML filters focus on 'attribute queries' that use the XML node 'PropertyName'. The first example from the OGC Filter Encoding 2.0 specificaton seems to use the XML node 'ValueReference' instead. In one of my workspaces I came across the situation that using the XML node 'PropertyName' didn't query out the required data, while using the ~similar (?) XML node 'ValueReference' did query out the desired data.
The example to the latter bullit was as follows. The following XML filter failed to query out the data:
<Filter>
<PropertyIsEqualTo>
<PropertyName>code</PropertyName>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
While the following XML filter did query out the data.
<Filter>
<PropertyIsEqualTo>
<ValueReference>code</ValueReference>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
Please note that the first type of query did work for me in most other cases (I think the problem arises from the number starting with a 0). I'm also not sure if the XML node 'ValueReference' can be used for all WFS versions (i.e. it might be only valid for WFS version 2.0)
Hi,
Thanks for the links. I am having problem understanding the lower corner and upper corner coordinates. Could you please help me how to identify them pictorially? I am using EPSG 3857.
Much appreciated for your help
Hi,
Thanks for the links. I am having problem understanding the lower corner and upper corner coordinates. Could you please help me how to identify them pictorially? I am using EPSG 3857.
Much appreciated for your help
Just use BoundsExtractor.
Lower left corner is _xmin, _ymin
Upper right corner is _xmax, _ymax