Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add merge policies #60710

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

JuhoErvasti
Copy link
Contributor

@JuhoErvasti JuhoErvasti commented Feb 21, 2025

Fixes #59494.

Similarly to already existing Split and Duplicate "policies" this PR implements Merge Policies, which determine the initial values in the Merge Features dialog. The PR includes the following merge policies:

From the existing Qgis::FieldDomainMergePolicy enum:

  • Sum: numeric fields only
  • Geometry Weighted: numeric fields only, uses weighted average by geometry
  • Default Value: uses the default value set in QGIS

New policies:

  • Unset Field: similarly to Split & Duplicate policies clears the field and lets the data provider populate any default value if one exists. If it doesn't the first feature is used (this is the behavior which is currently implemented)
  • Largest Geometry: use the value from the feature with the biggest geometry (length/area/number of parts for multipoints)
  • Minimum Value: numeric fields only
  • Maximum Value: numeric fields only
  • Skip Attribute: sets the initial state to "Skip", if not modified manually value will be NULL

Initial merge dialog before PR:
MERGEPOLICY_BEFORE

Initial merge dialog after PR:
MERGEPOLICY_AFTER

Configuring the policies:
image

@github-actions github-actions bot added this to the 3.44.0 milestone Feb 21, 2025
Copy link

github-actions bot commented Feb 21, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit e790397)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit e790397)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DB default values override actual values in merge selected features tool
1 participant