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

Random Points in Polygons behaves unexpectedly #58737

Closed
1 of 2 tasks
belg4mit opened this issue Sep 13, 2024 · 1 comment · Fixed by #58815
Closed
1 of 2 tasks

Random Points in Polygons behaves unexpectedly #58737

belg4mit opened this issue Sep 13, 2024 · 1 comment · Fixed by #58815
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@belg4mit
Copy link

What is the bug or the crash?

Although the on-screen description of this feature explains that a point is created for every feature in the source layer, the principle of least surprise would suggest that when the number of points to create is specified by a field that polygons with a null or zero value for the given value should be skipped. Otherwise one can end up with incorrect results if one does not notice this counter-intuitive behavior and removes the null entries. If there is some need for null points, it should be via checkbox which is unchecked by default if a field is used for the point count.

Steps to reproduce the issue

Select a polygon layer with a sparse numeric field and use said field as the point count for this tool.

Versions

Grenobile

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@belg4mit belg4mit added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 13, 2024
@agiudiceandrea agiudiceandrea added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Sep 13, 2024
@agiudiceandrea
Copy link
Contributor

Thanks for reporting. As a workaround, you could use the expression coalesce("field_name", 0) as data-defined override property in order to make the algorithm create no point for features with null value in the "field_name" field.

@elpaso elpaso self-assigned this Sep 19, 2024
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 20, 2024
When POINTS_NUMBER is set to an expression and the expression
evaluation returns an invalid value, set the value to 0 instead
of 1 (which is logically the min value for the fixed number option).

Fixes qgis#58737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants