Skip to content

Add option to ignore whitespace when detecting label collisions (Request in QGIS) #10677

@qgis-bot

Description

@qgis-bot

Request for documentation

From pull request qgis/QGIS#64550
Author: @nyalldawson
QGIS version: 4.0

Add option to ignore whitespace when detecting label collisions

PR Description:

(builds off qgis/QGIS#64540)

This new option (which is available ONLY for curved label placement modes) controls how QGIS treats whitespace (ie spaces or tabs) in label text when when determining whether two labels collide (or when a label collides with an obstacle feature). The existing (and default) behavior is that spaces are treated the same as text characters, and a label is not permitted to overlap spaces in another label.

When the new "Ignore label whitespace when detecting collisions" option is checked, then whitespace in the text will be ignored
when checking for overlapping labels (or labels colliding with obstacles).

This is useful when labeling long line features, when the word spacing is large and it is desirable to allow text or other features to sit within the label spaces. (Eg when labeling rivers or roads)

The setting can be data defined, to eg allow it to be enabled only for features of sufficient length.

Default setting (treating whitespace as a collision):

image

Ignoring label whitespace when detecting collisions:

image

Sponsored by LINZ

Commits tagged with [need-docs] or [FEATURE]

"[feature] Add option to ignore whitespace when detecting label collisions\n\nThis new option (which is available ONLY for curved label placement\nmodes) controls how QGIS treats whitespace (ie spaces or tabs)\nin label text when when determining whether two labels collide (or\nwhen a label collides with an obstacle feature). The existing (and\ndefault) behavior is that spaces are treated the same as text\ncharacters, and a label is not permitted to overlap spaces in\nanother label.\n\nWhen the new "Ignore label whitespace when detecting collisions"\noption is checked, then whitespace in the text will be ignored\nwhen checking for overlapping labels (or labels colliding with\nobstacles).\n\nThis is useful when labeling long line features, when the\nword spacing is large and it is desirable to allow text\nor other features to sit within the label spaces. (Eg when\nlabeling rivers or roads)\n\nSponsored by LINZ"

Metadata

Metadata

Assignees

Labels

4.0QGIS 4.0 new featuresLabelsLayer labels properties

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions