-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
reload output layer on successful execution of GDAL rasterize algorithm (fix #45729) #47055
Conversation
continue | ||
|
||
l.dataProvider().reloadData() | ||
context.temporaryLayerStore().addMapLayer(l) |
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.
why do we re-add this here? won't it already be in that store?
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.
It is re-added in order to have an updated layer with the reloaded data. But seems you are right and this line can be safely removed.
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.
Thanks! Ultimately I think we should consider moving this logic to a function in QgsProcessingContext (something like ::reloadLayersWithPath(....) ), but that's entirely optional 👍
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.
Actually maybe ::invalidateLayersAtPath(...) is better
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.
Do you think it should be done as a part of this PR or it is better to do it in a follow-up PR targeted only at master branch?
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.
Yep, a follow up PR sounds good!
Description
GDAL algorithms "Rasterize (overwrite with fixed value)" and "Rasterize (overwrite with attribute)" alter input raster but does not refresh it. As a result if raster already added to canvas user continues to work with the old "snapshot" of raster layer.
Fixes #45729.