You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Author Name: Paul van Genuchten (Paul van Genuchten)
Original Redmine Issue: 16539
Redmine category:data_provider
Currently if you use the api from a python plugin to add a geopackage to the project (as used in https://github.com/pka/qgpkg) a popup is displayed giving the option to select tables to add to the project. This is undesirable, since the plugin at that point already knows which layers it wants to add.
I suggest to extend the geopackage api to expose in the addVectorLayer method an optional parameter "tables" that, if filled, will override the popup and add the selected tables directly.
QGIS uses ogr to open a geopackage
the plugin is passing the file to GDAL/OGR, who is doing all the work
This is how a file can be opened
.addVectorLayer(gpkg_path, "", "ogr")
it calls a generic vector provider, and passes the OGR driver
for most cases, when you call this function, you get back one layer
But in the case of geopackage you get multiple layers; this is the issue
The text was updated successfully, but these errors were encountered:
Author Name: Paul van Genuchten (Paul van Genuchten)
hint from @pkalberer
Apparantly this is possible:
.addVectorLayer(gpkg_path + "|layername=" + layername, title, "ogr")
so to add the layername concatenated with |
Author Name: Paul van Genuchten (Paul van Genuchten)
Original Redmine Issue: 16539
Redmine category:data_provider
Currently if you use the api from a python plugin to add a geopackage to the project (as used in https://github.com/pka/qgpkg) a popup is displayed giving the option to select tables to add to the project. This is undesirable, since the plugin at that point already knows which layers it wants to add.
I suggest to extend the geopackage api to expose in the addVectorLayer method an optional parameter "tables" that, if filled, will override the popup and add the selected tables directly.
https://github.com/qgis/QGIS/blob/af236c4ef8303f4ff95f9f0733d25e08659318eb/python/plugins/db_manager/db_plugins/gpkg/plugin.py
QGIS uses ogr to open a geopackage
the plugin is passing the file to GDAL/OGR, who is doing all the work
This is how a file can be opened
.addVectorLayer(gpkg_path, "", "ogr")
it calls a generic vector provider, and passes the OGR driver
for most cases, when you call this function, you get back one layer
But in the case of geopackage you get multiple layers; this is the issue
The text was updated successfully, but these errors were encountered: