Feature request #12136

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

Added by mark volz about 2 years ago. Updated almost 2 years ago.

Status:Closed Start Date:02/05/2015
Priority:Normal Due date:
Assigned to:- % Done:


Target version:-
Platform: Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:



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 dc4049ddff09cc1b324dd95f48df29abef92f90e
Added by Nyall Dawson almost 2 years ago

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


Updated by Giovanni Manghi about 2 years ago

  • Category set to Labelling

Updated by Nyall Dawson almost 2 years ago

  • Status changed from Open to Closed

Also available in: Atom