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

Improves the GDAL clip by mask layer tool #9445

Conversation

gioman
Copy link
Contributor

@gioman gioman commented Mar 9, 2019

Description

Adds the option to allow choose the output resolution and the multithreaded warping option## Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

  • Commit messages are descriptive and explain the rationale for changes
  • Commits which fix bugs include fixes #11111 in the commit message next to the description
  • Commits which add new features are tagged with [FEATURE] in the commit message
  • Commits which change the UI or existing user workflows are tagged with [needs-docs] in the commit message and contain sufficient information in the commit message to be documented
  • I have read the QGIS Coding Standards and this PR complies with them
  • This PR passes all existing unit tests (test results will be reported by travis-ci after opening this PR)
  • New unit tests have been added for core changes
  • I have run the scripts/prepare-commit.sh script before each commit
  • Did not drink while coding

…hoose the output resolution and the multithreaded warping option
@gioman
Copy link
Contributor Author

gioman commented Mar 9, 2019

Patch by @PedroVenancio

@m-kuhn m-kuhn added the Backport Is a backport of another pull request label Mar 10, 2019
Copy link
Collaborator

@nyalldawson nyalldawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -81,9 +94,26 @@ def initAlgorithm(self, config=None):
self.tr('Match the extent of the clipped raster to the extent of the mask layer'),
defaultValue=True))
self.addParameter(QgsProcessingParameterBoolean(self.KEEP_RESOLUTION,
self.tr('Keep resolution of output raster'),
self.tr('Keep resolution of input raster'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a bug fix? Would be good to separate this commit so it can be backported

defaultValue=False))

self.addParameter(QgsProcessingParameterBoolean(self.SET_RESOLUTION,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this parameter seems redundant -- we could cover the same functionality by testing if X_RESOLUTION and Y_RESOLUTION are set and not None. (and throw an exception if only one is set and not the other)

self.tr('Set output file resolution'),
defaultValue=False))
self.addParameter(QgsProcessingParameterNumber(self.X_RESOLUTION,
self.tr('X Resolution to output bands'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.tr('X Resolution to output bands'),
self.tr('X Resolution for output bands'),

defaultValue=None,
optional=True))
self.addParameter(QgsProcessingParameterNumber(self.Y_RESOLUTION,
self.tr('Y Resolution to output bands'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.tr('Y Resolution to output bands'),
self.tr('Y Resolution for output bands'),

optional=True))
multithreading_param = QgsProcessingParameterBoolean(self.MULTITHREADING,
self.tr('Use multithreaded warping implementation'),
defaultValue=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this should default to true?

@nyalldawson
Copy link
Collaborator

I just noticed this is targeted at 3.4 -- is that valid? Looks like a new feature to me.

@gioman
Copy link
Contributor Author

gioman commented Mar 11, 2019

I just noticed this is targeted at 3.4 -- is that valid? Looks like a new feature to me.

@nyalldawson yes I see your point. Is not really a bug fix.

@gioman gioman closed this Mar 11, 2019
@PedroVenancio
Copy link
Contributor

Hi @nyalldawson

This feature/pull request was a mix of:

The proposal for the backport was for that reasons, but I understand that there are some changes, and can be considered new features.

@nyalldawson Please, change the code where you consider that it can be improved. Although it is functional, I believe the code can be much more polite.

I see one problem in it, as it is using QgsProcessingParameterBoolean (and not radio buttons). So, a user can check both KEEP_RESOLUTION and SET_RESOLUTION at the same time. Is there any form to put them mutually exclusive in Processing? If not, I think a user needs to know what is doing when activate an option that is, by default, unselected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport Is a backport of another pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants