Solved

How can I use Published Parameters in an WFS Filter?

  • 13 October 2016
  • 6 replies
  • 7 views

Badge

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

icon

Best answer by itay 13 October 2016, 16:13

View original

6 replies

Badge +16

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.

Badge

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.

Badge +16

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?

 

 

Badge +16

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?

 

 

Badge
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

 

 

Badge +11

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)

 

 

Reply