[mapserver-users] WFS field type errors on FES filter

PE Lord pe_lord at protonmail.com
Wed May 4 06:28:37 PDT 2022


Hi there!

I've got a lot of fields stored as character/text but their contents are integers/numbers.

Ex: In my DB (postgresql), I have tableA with fieldA. FieldA is declared as a character(2) but the content of rows are numbers... i.e. 71

The issue here is when I filter my data (QGIS or my web app) :

...?
SERVICE=WFS&
REQUEST=GetFeature&
VERSION=2.0.0&
TYPENAMES=ms:tableA&
STARTINDEX=0&COUNT=1000&
SRSNAME=urn:ogc:def:crs:EPSG::4326&
FILTER=
<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>geometry</fes:ValueReference>
<gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<gml:lowerCorner>40.77839999999999776 -87.96420000000000528</gml:lowerCorner>
<gml:upperCorner>51.88969999999999771 -68.37210000000000321</gml:upperCorner>
</gml:Envelope>
</fes:BBOX>
<fes:PropertyIsEqualTo xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:ValueReference>FieldA</fes:ValueReference>
<fes:Literal xmlns:fes="http://www.opengis.net/fes/2.0">71</fes:Literal>
</fes:PropertyIsEqualTo>
</fes:And>
</fes:Filter>

Mapserver return this error

<ows:ExceptionText>msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs</ows:ExceptionText>

To fix this issue, I know that I must declare gml_fieldA_type "Character".

Here the question: There is a method to automatically declare the type of all of thems?

The real issue about this question is that I have to handle near a thousand of layers, each of them containning a lot of fields! It's a scale issue!

Thanks

Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20220504/3e78e9f1/attachment.htm>


More information about the MapServer-users mailing list