-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add maximum distance setting for point labels #57415
Add maximum distance setting for point labels #57415
Conversation
@nyalldawson A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
3456978
to
e8422db
Compare
* always be respected. | ||
* | ||
* \see setMaximumDistance() | ||
* \see distLabel() |
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.
Completely unrelated to your PR: TODO QGIS 4.0: distLabel() -> distanceToLabel() or something 😆
For the "Around point" and "Cartographic" placement modes, this adds a new optional setting for the maximum distance of the labels from the feature. It's used together with the existing distance setting to define a range of distances at which labels may be placed from their corresponding point features. This adds more flexibility to the placement for these layers, ultimately allowing for more labels to be placed in busy maps. When the layer is set to the "around point" mode, then label candidates which are closer to the point will always be prefered over those which are further away. When the layer is set to the "cartographic" mode, then the default behavior is also to prioritize closer labels. A new combo box allows users to control the priority, with an option for prefering position ordering. If this option is set, then candidates at the corresponding positions (eg top left) are preferred regardless of how far they are from the point, with the labelling falling back to alternate positions only when no labels can be placed up to the maximum label distance. Sponsored by Rubicon Concierge Real Estate Services
Let's fix one thing at a time
e8422db
to
8c0f2e6
Compare
@nyalldawson |
(Temporarily includes #57404)
For the "Around point" and "Cartographic" placement modes, this adds a new optional setting for the maximum distance of the labels from the feature. It's used together with the existing distance setting to define a range of distances at which labels may be placed from their corresponding point features.
This adds more flexibility to the placement for these layers, ultimately allowing for more labels to be placed in busy maps.
When the layer is set to the "around point" mode, then label candidates which are closer to the point will always be prefered
over those which are further away.
When the layer is set to the "cartographic" mode, then the default behavior is also to prioritize closer labels. A new combo box
allows users to control the priority, with an option for prefering position ordering. If this option is set, then candidates at the corresponding positions (eg top left) are preferred regardless of how far they are from the point, with the labelling falling
back to alternate positions only when no labels can be placed up to the maximum label distance.
Sponsored by Rubicon Concierge Real Estate Services
To demonstrate, here's how the candidates look for a standard point layer in cartographic mode:
If we bump the maximum distance to 4.5 mm, then here's how the candidates look:
These videos demonstrate how the prioritization setting affects things:
In the default "prefer closest" mode, the label will remain as close as possible to the point. The top right placement is initially prefered, but then we fall back to close labels on the top right, bottom right, bottom left, etc. More distant labels are only placed as a last resort:
Peek.2024-05-14.15-02.mp4
In "Prefer position ordering" mode, the label will prefer to stay in the top right placement, immediately falling back further candidates to the top right. It's only when no candidates can be placed in the top right within the maximum distance that it falls back to the top left placement.
Peek.2024-05-14.15-02.3.mp4