Hi devs, a few days ago I wrote a patch to load a spatialite layer using a custom query. It works in the same manner as it was done for the postgres provider.
Here the ticket [1]. I know that Nov 23 starts the feature freeze, but I hope we can include it in QGis1.6. I did many tests and seems it works fine. The following is a python code snippet of its usage: 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' AND t.Peoples > 10000 AND Contains(r.Geometry, t.Geometry)", uri = QgsDataSourceURI() uri.setDatabase('/home/brushtyler/Projects/Work/Faunalia/spatialite/test-2.3.sqlite') uri.setDataSource('', '(%s)' % sql, 'Geometry', '', 'PK_UID') qgis.utils.iface.addVectorLayer(uri.uri(), "Towns in RT", 'spatialite') Cheers. [1] https://trac.osgeo.org/qgis/ticket/3139 -- Giuseppe Sucameli
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer