Skip to main content
Solved

How can I use Published Parameters in an WFS Filter?


Forum|alt.badge.img

Hi

can anyone halep me? I have a chanllange to solve.

I have a WFS-Reader with different features (Houses, Streets, Trees). All of this feature contain a identical attribute (Commune_ID).

Now I like to use the filter because I need only the data from one commune (on the Source-WFS are data from many many communes). So I give the Commune_ID as an Published Parameter to the workbench.

How have I to form the XML Filter Expression that I get only the used data? But I need it from all 3 features.

Thanks for your help

Best answer by itay

Hi @michaels,

The following syntax works for a WFS filter:

<Filter>

<PropertyIsEqualTo>

<PropertyName>SomeProperty</PropertyName>

<Literal>100</Literal>

</PropertyIsEqualTo>

</Filter>

If you want to use it as a published parameter then you can publish the XML filter reader parameter and use the syntax.

The filter will be applied to all feature types of the WFS reader, so if you have a feature type that needs a second filter syntax you can add a second reader.

Hope this helps.

View original
Did this help you find an answer to your question?

6 replies

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • Best Answer
  • October 13, 2016

Hi @michaels,

The following syntax works for a WFS filter:

<Filter>

<PropertyIsEqualTo>

<PropertyName>SomeProperty</PropertyName>

<Literal>100</Literal>

</PropertyIsEqualTo>

</Filter>

If you want to use it as a published parameter then you can publish the XML filter reader parameter and use the syntax.

The filter will be applied to all feature types of the WFS reader, so if you have a feature type that needs a second filter syntax you can add a second reader.

Hope this helps.


Forum|alt.badge.img
  • Author
  • October 13, 2016

Hi itay

thanks very much. That works perfectly when I have only one feature. If I have more than one I became this error:

ERROR |<ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance=" xmlns:ows="http://www.opengis.net/ows=" version="1.1.0=" language="en-US=" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd="> <ows:Exception exceptionCode="InvalidParameterValue=" locator="filter=">

<ows:ExceptionText>msWFSGetFeature(): WFS server error. Wrong number of filter elements, one filter must be specified for each feature type listed in the TYPENAME parameter.

And otherwise it works perfect with one feature but when I replace the number (100 in your example) with the published parameter ($(commune_id)) then it works not. I think it is because the paramter could not be read into the filter-expression.


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • October 13, 2016
michaels wrote:

Hi itay

thanks very much. That works perfectly when I have only one feature. If I have more than one I became this error:

ERROR |<ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance=" xmlns:ows="http://www.opengis.net/ows=" version="1.1.0=" language="en-US=" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd="> <ows:Exception exceptionCode="InvalidParameterValue=" locator="filter=">

<ows:ExceptionText>msWFSGetFeature(): WFS server error. Wrong number of filter elements, one filter must be specified for each feature type listed in the TYPENAME parameter.

And otherwise it works perfect with one feature but when I replace the number (100 in your example) with the published parameter ($(commune_id)) then it works not. I think it is because the paramter could not be read into the filter-expression.

I know it works if you use the all filter expression as the parameter value....

 

Can you share the WFS link?

 

 


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • October 13, 2016
michaels wrote:

Hi itay

thanks very much. That works perfectly when I have only one feature. If I have more than one I became this error:

ERROR |<ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance=" xmlns:ows="http://www.opengis.net/ows=" version="1.1.0=" language="en-US=" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd="> <ows:Exception exceptionCode="InvalidParameterValue=" locator="filter=">

<ows:ExceptionText>msWFSGetFeature(): WFS server error. Wrong number of filter elements, one filter must be specified for each feature type listed in the TYPENAME parameter.

And otherwise it works perfect with one feature but when I replace the number (100 in your example) with the published parameter ($(commune_id)) then it works not. I think it is because the paramter could not be read into the filter-expression.

Did you change the name of the property (SomeProperty) in the example with the correct typename?

 

 


Forum|alt.badge.img
  • Author
  • October 13, 2016
itay wrote:
I know it works if you use the all filter expression as the parameter value....

 

Can you share the WFS link?

 

 

Sorry, I can't share the link, because you need user and password and I can't share them here ;-)

 

could I send you my workbench? Perhaps you can solve my problem. Can you send me your Mailadress to michael.sult@geoinfo.ch?

 

Thanks

 

 


rylanatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • October 18, 2016
michaels wrote:

Hi itay

thanks very much. That works perfectly when I have only one feature. If I have more than one I became this error:

ERROR |<ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance=" xmlns:ows="http://www.opengis.net/ows=" version="1.1.0=" language="en-US=" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd="> <ows:Exception exceptionCode="InvalidParameterValue=" locator="filter=">

<ows:ExceptionText>msWFSGetFeature(): WFS server error. Wrong number of filter elements, one filter must be specified for each feature type listed in the TYPENAME parameter.

And otherwise it works perfect with one feature but when I replace the number (100 in your example) with the published parameter ($(commune_id)) then it works not. I think it is because the paramter could not be read into the filter-expression.

@michaels - Make sure that you have set the XML Filter Expression to a User Parameter (http://screencast.com/t/I94Tqni5vAe). Please note that this User Parameter can contain reference to another User Parameter (http://screencast.com/t/LIt49KOz)

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings