[Qgis-developer] data provider in a custom app

Tim Sutton lists at linfiniti.com
Thu Jan 23 14:12:18 PST 2014


Hi


On Thu, Jan 23, 2014 at 3:58 PM, Denis Rouzaud <denis.rouzaud at gmail.com>wrote:

>  Hi all,
>
> I am trying to do a custom application using QGIS libs and I have trouble
> to use data providers (i.e. spatialite).
>
> In my application doing, QgsProviderRegistry::instance()->pluginList()
> returns " No data provider plugins are available. No vector layers can be
> loaded".
>
> Then of course, trying to create a new db as it is done on
> QgsNewSpatialiteLayerDialog is impossible (
> QgsProviderRegistry::instance()->library( "spatialite" );  )
> and loading layers with
> QgsVectorLayer* vl = new QgsVectorLayer( "dbname='path_to_sqlite_file'
> table='mytable'' (geometry) sql=", "layername", "spatialite" );
> fails.
>
> I believe I am missing something fundamental here, but I have no idea what.
>
> If anybody has a lead, thanks a lot.
>

Did you ensure the QGIS_PREFIX_PATH is set and call initQgis? See [1] for
an example.

[1] https://github.com/AIFDR/inasafe/blob/master/safe/common/testing.py#L692



Regards

Tim

>
> Cheers,
>
> Denis
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Tim Sutton - QGIS Project Steering Committee Member
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Irc: timlinux on #qgis at freenode.net
==============================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140124/9a153d78/attachment.html>


More information about the Qgis-developer mailing list