[QGIS-Developer] QGIS Server 3.4.7 and WFS Filtering PropertyIsLike

René-Luc Dhont rldhont at gmail.com
Wed Jun 12 01:06:44 PDT 2019


Hi Luca,

The OGC Filter element is required as the document element for filter 
parameter.

Regards,
René-Luc

Le 11/06/2019 à 15:59, Luca Manganelli a écrit :
> Addendum.
>
> I discovered what problem was.
>
> OWSLib generates an URL like this:
>
> http:// ....WFSHOST .../&FILTER=<ogc:PropertyIsLike  wildCard="%" 
> singleChar="_" escapeChar="\" 
> matchCase="false"><ogc:PropertyName>nome_via</ogc:PropertyName><ogc:Literal>VIA 
> A%</ogc:Literal></ogc:PropertyIsLike>
>
> but it seems that QGIS Server doesn't like this. We should add 
> <ogc:Filter> and </ogc:Filter> at start and the end of the FILTER value:
>
> http:// ....WFSHOST .../&FILTER=<ogc:Filter><ogc:PropertyIsLike 
>  wildCard="%" singleChar="_" escapeChar="\" 
> matchCase="false"><ogc:PropertyName>nome_via</ogc:PropertyName><ogc:Literal>VIA 
> A%</ogc:Literal></ogc:PropertyIsLike></ogc:Filter>
>
> with the last URL, the WFS query works!
>
>
>
>
> Il giorno mar 11 giu 2019 alle ore 14:18 Luca Manganelli 
> <luca.manganelli at comune.trento.it 
> <mailto:luca.manganelli at comune.trento.it>> ha scritto:
>
>     Hello,
>
>     I'm trying to make this python 3 code with OwsLib working.
>     In particular, I'm searching a road with the name starting by "VIA
>     F.", but QGIS Server returns me a road named VIA MATTEOTTI...
>
>     Does QGIS Server support PropertyIsLike in WFS?
>
>
>     #!/usr/bim/python3
>     from owslib.wfs import WebFeatureService
>     from owslib.etree import etree
>     from owslib.fes import PropertyIsEqualTo, PropertyIsLike, BBox
>
>     wfs =
>     WebFeatureService(url='https://cartografia.comunelavis.it/wms/cbase')
>
>     filt = PropertyIsLike(propertyname='nome_via', literal='VIA F.%',
>     wildCard='%', matchCase=False)
>     filterxml = etree.tostring(filt.toXML()).decode("utf-8")
>
>     feature = wfs.getfeature(typename=['Civici'], maxfeatures=1,
>     filter=filterxml)
>     gml = etree.parse(feature)
>     print(etree.tostring(gml))
>
>
>
> -- 
> Luca Manganelli
> Assistente informatico
> Servizio Innovazione e Sistemi digitali
> Via Ezio Maccani 148
> 38121 Trento (TN)
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190612/d687c95e/attachment.html>


More information about the QGIS-Developer mailing list