<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Luca,<br>
<br>
The OGC Filter element is required as the document element for
filter parameter.<br>
<br>
Regards,<br>
René-Luc<br>
<br>
<div class="moz-cite-prefix">Le 11/06/2019 à 15:59, Luca Manganelli
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAGKduJ1t112u37NMkK-S+Q_X4T20_=e_4npbqy-9G10b1DnkBQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Addendum.</div>
<div><br>
</div>
<div>I discovered what problem was.</div>
<div><br>
</div>
<div>OWSLib generates an URL like this:</div>
<div><br>
</div>
<div>http:// ....WFSHOST .../&FILTER=<ogc:PropertyIsLike
wildCard="%" singleChar="_" escapeChar="\"
matchCase="false"><ogc:PropertyName>nome_via</ogc:PropertyName><ogc:Literal>VIA
A%</ogc:Literal></ogc:PropertyIsLike></div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>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></div>
<div><br>
</div>
<div>with the last URL, the WFS query works!<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Il giorno mar 11 giu 2019 alle
ore 14:18 Luca Manganelli <<a
href="mailto:luca.manganelli@comune.trento.it"
moz-do-not-send="true">luca.manganelli@comune.trento.it</a>>
ha scritto:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
<div>I'm trying to make this python 3 code with OwsLib
working.</div>
<div>In particular, I'm searching a road with the name
starting by "VIA F.", but QGIS Server returns me a road
named VIA MATTEOTTI...<br>
</div>
<div><br>
</div>
<div>Does QGIS Server support PropertyIsLike in WFS?<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>#!/usr/bim/python3<br>
</div>
<div>from owslib.wfs import WebFeatureService<br>
from owslib.etree import etree<br>
from owslib.fes import PropertyIsEqualTo, PropertyIsLike,
BBox<br>
<br>
wfs = WebFeatureService(url='<a
href="https://cartografia.comunelavis.it/wms/cbase"
target="_blank" moz-do-not-send="true">https://cartografia.comunelavis.it/wms/cbase</a>')<br>
<br>
filt = PropertyIsLike(propertyname='nome_via',
literal='VIA F.%', wildCard='%', matchCase=False)<br>
filterxml = etree.tostring(filt.toXML()).decode("utf-8")<br>
<br>
feature = wfs.getfeature(typename=['Civici'],
maxfeatures=1, filter=filterxml)<br>
gml = etree.parse(feature)</div>
<div>print(etree.tostring(gml))<br>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<br>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>Luca Manganelli<br>
Assistente informatico<br>
Servizio Innovazione e Sistemi digitali<br>
Via Ezio Maccani 148<br>
38121 Trento (TN)</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
</body>
</html>