-
-
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
[PROCESSING] Speed up dissolve (esp. when using dissolve field) #2263
Conversation
fields = QgsFields() | ||
if useField: | ||
fieldname = self.getParameterValue(Dissolve.FIELD) | ||
fieldIdx = vlayerA.fieldNameIndex(fieldname) |
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's dangerous to request the index from the layer and then use it to get a field from the provider.
I would try to avoid direct access to the provider wherever possible. field = vlayerA.field(fieldname)
should be sufficient.
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.
Hi Matthias,
thanks for the hint. Will recode.
@bstroebl I tested it on a small file here and the dissolve field (string) was not respected. It would be great to have a unit test come along with it (it's not a requirement but I'll buy you a beer next time if you sponsor the first ftools unit test) |
Matthias, did you untick Dissolve all (do not use field)? If yes, could you send me the data, please?
|
Tried again and could not reproduce the error. Can you clarify on untick dissolve all? For me there is no checkbox, it's just another entry in the combobox. Am I testing the wrong tool now? |
Probably you are right, so if unique id field is [not set] then dissolve all would be assumed. The derivation of the field index could be put into a try-except block to check if a field has been chosen. The labels would need to clearly state this behaviour. |
Sounds good. Or adding logic to disable the combobox when the checkbox is checked. |
Would be the better solution but I do not know if in Processing you can change widgets' settings when user sets other widgets. Would need Qt's signal/slot stuff. |
No idea, I never did a processing GUI. If it's not possible, your proposal sounds absolutely fine to me. |
So these two would work:
|
I think it is confusing to have two different GUI controls which may be set to contradicting states - or having enabled widgets which do not have any meaning. |
ok, I will implement No 2 then |
No description provided.