Feature request #12136
Add option to only place a label if it fits inside of a polygon
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Labelling | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 20330 |
Description
Hello,
It would be useful if there was an option to only place labels if they fit inside of the polygon. Currently the closest option that I am aware of is to set the "Suppress labeling of features smaller than" option. This option works great if all the labels will have the same number of characters - such as a Parcel Identification Number. However, "suppress labeling of feature classes smaller than" does not work well if we are labels have various lengths such as County Name.
I think there are three parts to making sure labels fit inside a polygon.- Calculate the width of the label, which can be done by taking the font width * the number of characters. Or more specifically adding the width of each character up in a label as some fonts have different width characters.
- Calculate the feature width. - This algorithim is already figured out with the "suppress labeling of features smaller than..." option.
- Only place a label if the label width is shorter than the feature width.
Thank you for your consideration
Associated revisions
[FEATURE][labeling] Add option to only draw labels which fit
completely within polygon features (fix #12136)
History
#1 Updated by Giovanni Manghi over 9 years ago
- Category set to Labelling
#2 Updated by Nyall Dawson over 9 years ago
- Status changed from Open to Closed
Fixed in changeset dc4049ddff09cc1b324dd95f48df29abef92f90e.