-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[DB Manager] Fix delete raster layer in GeoPackage (Fix #57751) #57754
[DB Manager] Fix delete raster layer in GeoPackage (Fix #57751) #57754
Conversation
See: #30907 (comment) |
I've also removed the Rename action for raster layer in a GeoPackage. |
no, it isn't supported currently. I've filed OSGeo/gdal#10201 about that |
if isinstance(item, SchemaItem) or isinstance(item, TableItem): | ||
if isinstance(item, SchemaItem) \ | ||
or (isinstance(item, TableItem) | ||
and not (self.hasGPKGSupport and item.getItemData().type == Table.RasterType)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the best way to check if the item is a raster layer in a GeoPackage container...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DB manager is ancient code, a more modern approach would be to use the connections API:
md = QgsProviderRegistry.instance().providerMetadata('postgres')
conn = md.createConnection("dbname='tinyows_demo' host=localhost port=5433 username='***' password='***'", {})
table = conn.table('public', 'demo3dlinestring')
bool(table.flags() & QgsAbstractDatabaseProviderConnection.TableFlag.Raster)
bool(table.flags() & QgsAbstractDatabaseProviderConnection.TableFlag.Vector)
It should work with all QGIS supported DB providers (GPKG included).
@agiudiceandrea see OSGeo/gdal#10213 Maybe you can add a branch to check for the next GDAL version. |
@elpaso thanks. QGIS/python/plugins/db_manager/db_plugins/gpkg/connector.py Lines 621 to 624 in 164ba02
|
I will update |
@elpaso, thanks again. I see that OSGeo/gdal#10213 has not been backported to the GDAL 3.9 branch so I it looks like it will be available in GDAL >= 3.10. Anyway I think it would be better if I remove the last commit [db manager] Don't add a Rename action for raster layer in GeoPackage from this PR so this PR can be merged now. |
164ba02
to
a840ebf
Compare
Hi @elpaso, I've removed the second commit from this PR. So it now only fixes the Delete functionality and can be merged and backported. |
PR: #57865. |
Description
Fixes the "Delete..." functionality for raster layers in GeoPackage containers.
Fixes #57751.
Looking at the reported issue, I noticed that also the "Rename..." functionality doesn't work for raster layers in GeoPackage containers (it is not possible to rename a raster layer in a GeoPackage container even using the Browser panel #30907).
@elpaso it looks like a
renameRasterTable
function is missing inQgsGeoPackageProviderConnection
.@rouault, is there a "simple" way to rename a raster layer in a GeoPackage? (it seems to me
ALTER TABLE ... RENAME TO ...
doesn't correctly work for raster layers in GeoPackage)UPDATE: I've also removed the Rename action for raster layer in a GeoPackage.UPDATE: I'll submit a new PR to fix the Rename action for raster layer in a GeoPackage.