[Qgis-developer] open vector data using specific GDAL driver

Martin Landa landa.martin at gmail.com
Sat Oct 29 03:30:38 PDT 2016


Hi all,

I wonder whether it's possible to specify GDAL driver when creating
QgsVectorLayer instance. The constructor allows passing uri, layer
name and provider. Is there any way how to specify GDAL driver which
will be used for opening datasource (let's say that we are working
with datasource which can be open by two different GDAL drivers).

composedURI = str(dbPath) + "|layername=" + dbTable
layer = QgsVectorLayer(composedURI, layerName, 'ogr')

Something like:

sqliteDriver = ogr.GetDriverByName('SQLite')
sqliteDataSource = sqliteDriver.Open(str(dbPath))

Thanks, Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


More information about the Qgis-developer mailing list