Bug report #13231

"Merge attribute of selected features" tools set ignored attributes to NULL

Added by Mathieu Bossaert over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:Nyall Dawson
Category:Vectors
Affected QGIS version:2.8.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21292

Description

I don't know if its a bug or a feature request because I did not use that tool before (but I try it on both 2.8 and 2.10 versions for Win 7).
Anyway when I choose an attribute to be ignored during the merge operation (for example the id), it is set to NULL.

Associated revisions

Revision 0bda18b6
Added by Nyall Dawson over 8 years ago

Fix merge attributes tool sets skipped attributes to null (fix #13231)

Revision 45d80f90
Added by Nyall Dawson over 8 years ago

Fix merge attributes tool sets skipped attributes to null (fix #13231)

(cherry-picked from 0bda18b6e04105d52cfe6f54792de2f2e2b4a925)

History

#1 Updated by Jürgen Fischer over 8 years ago

  • Subject changed from "Merge attribute of selected features" tools set ingored attributes to NULL to "Merge attribute of selected features" tools set ignored attributes to NULL

#2 Updated by Jukka Rahkonen over 8 years ago

What do you suggest? If you merge features A and B which have an attribute X with values
a) for A: X=1, for B: X=1
b) for A: X=1, for B: X=2

In case a) it feels natural to set X=1 also for the new merged feature. How about case b), would you like to get concatenated string X=1,2? What if the datatype of the column is numeric, would it be 1+2 then, and how should we deal with Boolean values?

#3 Updated by Mathieu Bossaert over 8 years ago

Maybe with do not talk about the same tool... It is not a feature aggregation, features are not merged :

http://docs.qgis.org/2.8/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html#merge-attributes-of-selected-features

So if all selected features are conserved with this tool, I think it could be logical and usefull to be able to conserve the initial value of that attribute.

#4 Updated by Jukka Rahkonen over 8 years ago

Right, we did not talk about the same tool.

I agree that there should be an option to leave the ignored attributes to their native value instead of setting them to NULL. It seems that the UI of this tool is a copy of the Merge features tool which lets user to select which value to give for the merged feature, including concatenate for strings and min/max/median/sum/mean for numbers.

If features are physically merged with the "Merge selected features" tool it is impossible to preserve the native attributes but there should be one more option for the "Merge attribute of selected features" tool: Keep native.

#5 Updated by Nyall Dawson over 8 years ago

  • Status changed from Open to Closed

#6 Updated by Harrissou Santanna over 8 years ago

  • Status changed from Closed to Reopened
  • Assignee set to Nyall Dawson

I suspect it's introduced by this commit but I may be wrong. sorry then :(
Now, when you "merge attributes of selected features", the dialog opens with all the merge attributes set to "skipped" by default. Would be better to keep some pre-filled fields as it was in previous releases and as it is when using "merge selected features" tool.
Most of the times, you (I) just need to change few fields. We should not oblige the user to manually enter new value for all fields. If an user wants to change/skip all the fields or most of them, then he'll use the "Skip all fields" tool.
master 4cdf05f

#7 Updated by Nyall Dawson over 8 years ago

  • Status changed from Reopened to Closed

Now, when you "merge attributes of selected features", the dialog opens with all the merge attributes set to "skipped" by default.

This was an intentional change. I think for something like this which has the potential to lead to overwriting data that users should have to intentionally select the fields they want to replace rather than defaulting to replacing everything. It's also a better workflow for tables with many columns - it's not often you'd want to replace EVERYTHING in the features, so starting with all skipped and leaving it to the user to manually select the columns to merge is a better approach.

#8 Updated by Harrissou Santanna over 8 years ago

Sorry, you're right. I mixed up "Skip" and "NULL" values.
It's indeed the best approach.

#9 Updated by Mathieu Bossaert over 8 years ago

Thanks a lot for that work !

Also available in: Atom PDF