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

reload output layer on successful execution of GDAL rasterize algorithm (fix #45729) #47055

Merged
merged 3 commits into from
Jan 31, 2022
Merged

reload output layer on successful execution of GDAL rasterize algorithm (fix #45729) #47055

merged 3 commits into from
Jan 31, 2022

Conversation

alexbruy
Copy link
Contributor

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.

@alexbruy alexbruy added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Jan 28, 2022
@github-actions github-actions bot added this to the 3.24.0 milestone Jan 28, 2022
@alexbruy alexbruy added the backport queued_ltr_backports Queued Backports label Jan 30, 2022
continue

l.dataProvider().reloadData()
context.temporaryLayerStore().addMapLayer(l)
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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 👍

Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport queued_ltr_backports Queued Backports Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"GDAL rasterize overwrite with attribute" does not refresh/reload output
2 participants