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

Luca Manganelli luca.manganelli at comune.trento.it
Tue Jun 11 06:59:06 PDT 2019


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> 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190611/e62100ee/attachment-0001.html>


More information about the QGIS-Developer mailing list