Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to skip layer table panel if adding a geopackage to the project using the api #24445

Closed
qgib opened this issue May 11, 2017 · 2 comments
Closed
Labels
Data Provider Related to specific vector, raster or mesh data providers Feature Request

Comments

@qgib
Copy link
Contributor

qgib commented May 11, 2017

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

@qgib
Copy link
Contributor Author

qgib commented May 18, 2017

Author Name: Alexander Bruy (@alexbruy)


  • tracker_id was changed from 1 to 2

@qgib
Copy link
Contributor Author

qgib commented Aug 24, 2017

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 |


  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Aug 24, 2017
@qgib qgib added Feature Request Data Provider Related to specific vector, raster or mesh data providers labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data Provider Related to specific vector, raster or mesh data providers Feature Request
Projects
None yet
Development

No branches or pull requests

1 participant