Skip to main content
Question

WFS with spaces not working

  • December 11, 2018
  • 4 replies
  • 68 views

Forum|alt.badge.img

Hi,

I'm trying to fetch data from the following WFS with a WFS-reader:

http://geodata.nationaalgeoregister.nl/bag/wfs?service=wfs&request=GetFeature&typeName=bag:pand&cql_filter=bag:identificatie LIKE '%25158110%25'

When I browse it in IE it works fine, but FME throws me the next error:

<WFS> An Exception Report was produced performing a `GetCapabilities' request
<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" version="2.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://geodata.nationaalgeoregister.nl/schemas/ows/1.1.0/owsAll.xsd">
  <ows:Exception exceptionCode="NoApplicableCode">
  Â  <ows:ExceptionText>Could not parse CQL filter list.
Lexical error at line 1, column 18. Â Encountered: &amp;quot;%&amp;quot; (37), after : &amp;quot;&amp;quot; Parsing : bag:identificatie%20LIKE%20&amp;apos;%158110%&amp;apos;.</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
A fatal error has occurred. Check the logfile above for details

I think the spaces in de cql-filter are causing problems. What is the right syntax for the WFS with the "like"-command?

Greetings Erwin

4 replies

david_r
Celebrity
  • December 11, 2018

You need to URL-encode the CQL clause to get rid of invalid characters, such as spaces, etc. You can use the TextEncoder for this, the result should look something like this:

cql_filter=bag:identificatie%20LIKE%20%27%25158110%25%27

Make sure that you only URL-encode what comes after the equal sign.


Forum|alt.badge.img
  • Author
  • December 11, 2018
david_r wrote:

You need to URL-encode the CQL clause to get rid of invalid characters, such as spaces, etc. You can use the TextEncoder for this, the result should look something like this:

cql_filter=bag:identificatie%20LIKE%20%27%25158110%25%27

Make sure that you only URL-encode what comes after the equal sign.

Thanx David, but the result is still the same. I changed the WFS-URL into 

http://geodata.nationaalgeoregister.nl/bag/wfs?service=wfs&request=GetFeature&typeName=bag:pand&cql_filter=bag:identificatie%20like%20%27%25158110%25%27

But the same error occurs:

url: 'http://geodata.nationaalgeoregister.nl:80/bag/wfs?SERVICE=WFS&REQUEST=GetCapabilities&cql_filter=bag:identificatie%20like%20'%158110%'&VERSION=2.0.0'
<WFS> An Exception Report was produced performing a `GetCapabilities' request
<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" version="2.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://geodata.nationaalgeoregister.nl/schemas/ows/1.1.0/owsAll.xsd">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Could not parse CQL filter list.
Lexical error at line 1, column 18.  Encountered: &amp;quot;%&amp;quot; (37), after : &amp;quot;&amp;quot; Parsing : bag:identificatie%20like%20&amp;apos;%158110%&amp;apos;.</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
A fatal error has occurred. Check the logfile above for details

trentatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • December 11, 2018

Hello @reijnen,

 

 

I believe the issue with the URL is the ECQL clause. I don't believe FME currently supports ECQL but rather uses the OGC XML Filter. An example of an XML Filter can be found here: https://knowledge.safe.com/questions/5017/how-to-use-the-xml-filter-in-the-wfs-reader.html

 

 

If this is functionality you would like to see added to FME, please submit an idea here: https://knowledge.safe.com/content/idea/list.html

 

 

I hope that helps!

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • December 11, 2018

Hi, @reijnen

I have used a cql_filter on a WFS service in the past but not via the reader, but by using the HTTPCaller.

See the HTTPCaller_wplWPL transformer in the FME Hub template here


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