-
-
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
Cannot resolve GPKG paths in custom path pre-processor #35650
Comments
What do you mean "nothing happens"? You'll need to provide more debugging information here. I'd suggest moving the "print (Old path)" line outside of the |
Thanks for your fast reply! It's easy to reproduce: store some layers with relative paths together with your QGIS project inside of a GPKG file. Copy the file to another location and rename it. With my code I was trying to repair the broken layer paths. |
Ok, it's definitely no bug ... I found the reason for "nothing happens" here: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-Bug-in-QgsPathResolver-td5402292.html. I'm using relative paths, which is not supported yet. Unfortunately it's not totally clear from API description, that relative paths are not possible to resolve. It would be nice, if we could resolve relative paths in a future release. Mainly for the reason of automatically repairing QGIS projects being stored in a GPKG together with their data (when the GPKGs are copied and renamed, the relative layer source paths are broken). |
The relative paths are resolved for GPKGs, what breaks your workflow is the file rename: the project file stored into the geopackage does not know that its datasource paths pointing to itself are not valid anymore. I'd say this is a bug (or an enhancement, if you prefer). |
@elpaso: you are totally right ... my last comment was wrong... I was a little bit confused and mixed up things. It's not a problem with path resolver here, it's a problem with the custom path pre-processor result being ignored, if the data source path is relative. And this could be a bug ;-) |
a bug in QGIS or a bug in your custom pre-processor? |
good question ;-) ... at least the print statements ("Old path:","New path:") show the right values. After the new values are returned, no path change is happening and the bad layer handler is popping up. |
What is the status of this report? |
From my perspective, I can live with a simple workaround using a custom Python plugin:
But for the majority of users it would be nice to have an inbuild mechanism for storing relative GPKG project layers, that won't get lost after a GPKG project file rename. |
When I try to resolve invalid GPKG paths during opening of a QGIS project, which is stored in the same GPKG file, nothing happens (see code below). Resolving of PostgreSQL layers works fine.
The text was updated successfully, but these errors were encountered: