Feature request #12136

Add option to only place a label if it fits inside of a polygon

Added by mark volz almost 10 years ago. Updated over 9 years ago.

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.
  1. 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.
  2. Calculate the feature width. - This algorithim is already figured out with the "suppress labeling of features smaller than..." option.
  3. Only place a label if the label width is shorter than the feature width.

Thank you for your consideration

Associated revisions

Revision dc4049dd
Added by Nyall Dawson over 9 years ago

[FEATURE][labeling] Add option to only draw labels which fit
completely within polygon features (fix #12136)

History

#1 Updated by Giovanni Manghi almost 10 years ago

  • Category set to Labelling

#2 Updated by Nyall Dawson over 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF