Answer: vlayer = QgsVectorLayer('track.shp', 'layer_name_you_like', 'ogr')
error_msg = '' error = QgsVectorFileWriter.writeAsVectorFormat( vlayer, 'test.sqlite', 'System', vlayer.crs(), 'SQLite', False, error_msg, [ "SPATIALITE=YES" , ] ) where: vlayer => vector layer which will be exported to spatialite 'test.sqlite' => absolute path to new spatialite database file 'System' => string that represents the file encoding vlayer.crs() => vector layer crs 'SQLite' => provider name False => export onlySelected? error_msg => if there is any error message will be put in that variable (if user don't care about error handling, set to None) [ "SPATIALITE=YES" , ] => database options. (here is the trick) Also, there is a class http://www.qgis.org/api/classQgsVectorLayerImport.html But, I didn't have success in create an empty database using the QgsVectorLayerImport. I think that class (QgsVectorLayerImport) expects a created spatialite database. -- Daniel Vaz
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer