[MapServer-users] filter issues with WFS

Seth G sethg at geographika.co.uk
Sat Feb 17 03:36:12 PST 2024


Hi Carlos,

If you add DEBUG 5 to the LAYER, and set the CONFIG MS_ERRORFILE do you get more details in the logs for why the filter is failing?
The error indicates MapServer cannot parse the filter. The unencoded filter is shown below. 

<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2">
<fes:And>
  <fes:BBOX>
   <fes:ValueReference>wkb_geometry</fes:ValueReference>
   <gml:Envelope srsName="urn:ogc:def:crs:EPSG::27700">
    <gml:lowerCorner>448535 197714</gml:lowerCorner>
    <gml:upperCorner>448849 197791</gml:upperCorner>
   </gml:Envelope>
  </fes:BBOX>
  <fes:Intersects xmlns:fes="http://www.opengis.net/fes/2.0">
   <fes:ValueReference>wkb_geometry</fes:ValueReference>
   <fes:Function xmlns:fes="http://www.opengis.net/fes/2.0" name="geomFromWKT">
    <fes:Literal xmlns:fes="http://www.opengis.net/fes/2.0">POLYGON((447915.65299999999115244 195673.18600000001606531, 449272.48200000001816079 195673.18600000001606531, 449272.48200000001816079 200345.65200000000186265, 447915.65299999999115244 200345.65200000000186265, 447915.65299999999115244 195673.18600000001606531))</fes:Literal>
   </fes:Function>
  </fes:Intersects>
</fes:And>
</fes:Filter>

I'm guessing the geomFromWKT is not supported, so the filter should pass a GML Polygon object to filter by using an intersecting geometry. See https://mapserver.org/ogc/filter_encoding.html#tests for an example

<Filter>
<Intersects>
<PropertyName>Geometry</PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>135.5329,34.6624 135.4921,34.8153 135.3673,34.7815
  135.3800,34.6216 135.5361,34.6210 135.5329,34.6624</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Intersects>
</Filter>

Seth

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika

On Mon, Feb 12, 2024, at 1:33 PM, Carlos Padron Florez via MapServer-users wrote:
> Hi,
> 
> I have a WFS version 2.0.0 and I want to request from it features using a filter but I get this error:
> msWFSGetFeature(): WFS server error. Invalid or Unsupported FILTER in GetFeature : <fes:Filter
> 
> The request is the following:
> 
> https://SERVER/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=ms:layername&STARTINDEX=0&COUNT=1000000&SRSNAME=urn:ogc:def:crs:EPSG::27700&FILTER=%3Cfes:Filter xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22 xmlns:gml%3D%22http://www.opengis.net/gml/3.2%22%3E%0A %3Cfes:And%3E%0A  %3Cfes:BBOX%3E%0A   %3Cfes:ValueReference%3Ewkb_geometry%3C/fes:ValueReference%3E%0A   %3Cgml:Envelope srsName%3D%22urn:ogc:def:crs:EPSG::27700%22%3E%0A    %3Cgml:lowerCorner%3E448535 197714%3C/gml:lowerCorner%3E%0A    %3Cgml:upperCorner%3E448849 197791%3C/gml:upperCorner%3E%0A   %3C/gml:Envelope%3E%0A  %3C/fes:BBOX%3E%0A  %3Cfes:Intersects xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22%3E%0A   %3Cfes:ValueReference%3Ewkb_geometry%3C/fes:ValueReference%3E%0A   %3Cfes:Function xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22 name%3D%22geomFromWKT%22%3E%0A    %3Cfes:Literal xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22%3EPOLYGON((447915.65299999999115244 195673.18600000001606531, 449272.48200000001816079 195673.18600000001606531, 449272.48200000001816079 200345.65200000000186265, 447915.65299999999115244 200345.65200000000186265, 447915.65299999999115244 195673.18600000001606531))%3C/fes:Literal%3E%0A   %3C/fes:Function%3E%0A  %3C/fes:Intersects%3E%0A %3C/fes:And%3E%0A%3C/fes:Filter%3E%0A
> 
> The same request, with obvious changes of server name, works on Geoserver. This request is generated by Qgis so I don't if I can fix it via Mapserver or via QGIS.
> Any ideas?
> 
> Kind regards
> 
> *Carlos Padrón, MRes *| Geomatics Team Lead
> 
>  
> 
> D: 01865 664120  W: www.gigaclear.com
> 
>  
> 
>  
> 
> signature_261337870
> 
> Gigaclear ltd, Building 1, Wyndyke Furlong, Abingdon, Oxfordshire, OX14 1UQ
> 
> Gigaclear plc is registered in England and Wales with company number 07476617
> 
>  
> 
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20240217/130a8a40/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-signature_.png
Type: image/png
Size: 10923 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20240217/130a8a40/attachment-0001.png>


More information about the MapServer-users mailing list