[mapserver-users] Filter could not be translated to OGR filter
Seth G
sethg at geographika.co.uk
Mon Mar 16 05:20:20 PDT 2020
Hi all,
I've run into a strange issue when using a WFS filter with spaces and an OGRCONNECTION.
I think I've narrowed it down to involving the following:
1. Using OGR CONNECTION (the filter is fine when using MapServer Shapefile connection) with a shapefile
2. Via a web server (I'm using IIS)
The following WFS filter:
<fes:Filter xsi:schemaLocation="http://www.opengis.net/fes/2.0 http://schemas.opengis.net/filter/2.0/filterAll.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><fes:PropertyIsLike wildCard="*" singleChar="." escape="!" matchCase="false"><fes:ValueReference>name</fes:ValueReference><fes:Literal>*Old T*</fes:Literal></fes:PropertyIsLike></fes:Filter>
Returns this error:
<ows:Exception exceptionCode="OperationProcessingFailed" locator="mapserv">
<ows:ExceptionText>msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed
msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.</ows:ExceptionText>
</ows:Exception>
Within the filter it is the Literal tag that has a problem - whenever the literal tag is greater than a certain number of characters.
The following work:
<fes:Literal>* R*</fes:Literal>
<fes:Literal>* O*</fes:Literal>
<fes:Literal>*Old*</fes:Literal>
<fes:Literal>*Fic*</fes:Literal>
The following breaks the filter:
<fes:Literal>*Ficc*</fes:Literal>
<fes:Literal>*Oldt</fes:Literal>
<fes:Literal>Old</fes:Literal> (a strange one as it is fewer characters than others)
I cannot recreate the issue using the command line passing in the exact same content, so I think it could relate to encoding of the filter in the POST request. I'm using "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" other types give parsing errors e.g. msOWSPreParseRequest(): OWS error. XML parsing error: Start tag expected, '<' not found
Perhaps the encoding makes the literal tag too long somewhere in OGR?
Any insights appreciated,
Seth
--
web:http://geographika.co.uk
twitter: @geographika
More information about the MapServer-users
mailing list