Hi all, <br>this morning Sandro Furieri applied my patch and now it's in trunk. See [1].<br>Cheers.<br><br>[1] <a href="https://trac.osgeo.org/qgis/changeset/14435">https://trac.osgeo.org/qgis/changeset/14435</a><br><br>
<div class="gmail_quote">On Thu, Oct 21, 2010 at 11:35 PM, Giuseppe Sucameli <span dir="ltr"><<a href="mailto:sucameli@faunalia.it">sucameli@faunalia.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi devs, <br><br>a few days ago I wrote a patch to load a spatialite layer using a custom query. <br>It works in the same manner as it was done for the postgres provider.<br><span style="font-family: comic sans ms,sans-serif;"></span><br>
Here the ticket [1].<br><br>I know that Nov 23 starts the feature freeze, but I hope we can include it in QGis1.6. <br>I did many tests and seems it works fine. <br><br>The following is a python code snippet of its usage:<br>
<br><span style="font-family: comic sans ms,sans-serif;">sql = "SELECT t.PK_UID, t.Name, (t.Peoples/1000) AS KPeoples, t.Geometry FROM Towns AS t, Regions AS r WHERE r.Name =
'TOSCANA' </span><span style="font-family: comic sans ms,sans-serif;">AND t.Peoples > 10000 AND Contains(r.Geometry,
t.Geometry)",</span><br style="font-family: comic sans ms,sans-serif;"><span style="font-family: comic sans ms,sans-serif;">uri = QgsDataSourceURI() </span><br style="font-family: comic sans ms,sans-serif;"><span style="font-family: comic sans ms,sans-serif;">uri.setDatabase('/home/brushtyler/Projects/Work/Faunalia/spatialite/test-2.3.sqlite')</span><br style="font-family: comic sans ms,sans-serif;">
<span style="font-family: comic sans ms,sans-serif;">uri.setDataSource('', '(%s)' % sql, 'Geometry', '', 'PK_UID')</span><br style="font-family: comic sans ms,sans-serif;"><span style="font-family: comic sans ms,sans-serif;">qgis.utils.iface.addVectorLayer(uri.uri(), "Towns in RT", 'spatialite')</span><br style="font-family: comic sans ms,sans-serif;">
<br><br>Cheers.<br clear="all"><br>[1] <a href="https://trac.osgeo.org/qgis/ticket/3139" target="_blank">https://trac.osgeo.org/qgis/ticket/3139</a><br><br>-- <br><font color="#888888">Giuseppe Sucameli<br><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Giuseppe Sucameli<br><br>