Feature request #3284

Wrapping long labels

Added by Michael Douchin almost 4 years ago. Updated over 2 years ago.

Status:Closed Start Date:
Priority:Low Due date:
Assigned to:Nathan Woodrow % Done:

100%

Category:Labelling
Target version:Version 1.7.4
Platform:All Resolution:fixed
Platform version: Patch supplied:No
Status info:0 Tag:

Description

Sometimes labels are very long, such as "River of the Big Dry Blue Reef". UMN Mapserver offers a way to wrap labels based on 2 parameters :

  • a max length (integer)
  • a wrap character, space by default

See http://mapserver.org/mapfile/label.html for more information.

I do not know how hard it is to implement this feature in the new label engine (considering curves, etc.)

Associated revisions

Revision f57892c73d8a3b4a3abe4b8659369720e9cc1329
Added by Nathan Woodrow over 2 years ago

[FEATURE] Add label wrapping on character. Semi Fixes #3284

History

Updated by Alister Hood over 3 years ago

I guess it would also be good if they could wrap to avoid collisions with features or other labels, instead of wrapping at a specified length :)

Updated by Alister Hood over 3 years ago

There is already a wrapping option.
But I have never figured out how to actually get layers to wrap. How is it supposed to work?

Updated by Alister Hood over 3 years ago

There is already a wrapping option. But I have never figured out how to actually get layers to wrap. How is it supposed to work?

Oh, I remember now. The User Guide says multiline labels work with a true line return. I'm not sure how you're supposed to enter a true line return though (on windows).

Updated by Alister Hood over 3 years ago

Aha, here's the answer from the mailing list:

You have to enter a "real" newline. If you want to enter multiline labels in QGIS you need to assign a TextEdit instead of LineEdit as edit widget in the vector layer properties' attributes tab.

Of course this feature request is still valid, as it is about automatic wrapping, not wrapping with a manual line break.

Updated by Michael Douchin almost 3 years ago

I think this request if no longer needed since the implementation of expression based labelling : http://woostuff.wordpress.com/2011/10/27/expression-based-labeling/

Updated by Nathan Woodrow almost 3 years ago

  • Assigned to deleted (nobody -)
  • Patch supplied set to No

I wouldn't close it just yet as the expression labeling thing doesn't really expose a function to wrap strings. It's on the todo list and shouldn't be to hard to add.

Updated by Giovanni Manghi over 2 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

Updated by Anonymous over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Updated by Nathan Woodrow over 2 years ago

  • Category changed from Map Canvas to Labelling
  • Assigned to set to Nathan Woodrow
  • Resolution set to fixed

I have added the ability to wrap labels based on a character, check on the advanced tab on the label dialog. Max length isn't done yet but it shouldn't be too hard to add.

Updated by Michael Douchin over 2 years ago

Nathan Woodrow wrote:

I have added the ability to wrap labels based on a character, check on the advanced tab on the label dialog. Max length isn't done yet but it shouldn't be too hard to add.

Thanks !

Updated by Nathan Woodrow over 2 years ago

How would you like max length handled. I was just thinking of copying how MapServer does it http://mapserver.org/mapfile/label.html#maxlength

Updated by Michael Douchin over 2 years ago

I think it makes sense. This way users won't have problem to use it if they come from mapserver.
Plus I think this is the easiest yet effective way to handle this issue

Updated by Alister Hood over 2 years ago

Nathan Woodrow wrote:

How would you like max length handled. I was just thinking of copying how MapServer does it http://mapserver.org/mapfile/label.html#maxlength

Just to clarify: are you proposing actually doing it in the expression builder?

Updated by Alister Hood over 2 years ago

While I can see the benefits of doing it the same way as other software, the mapserver way isn't particularly intuitive. Especially things like this:

If maxlength > 0 and wrap = ‘char’, insert a newline at the FIRST wrap character AFTER maxlength characters

I would think that users would expect it to wrap at the LAST wrap character BEFORE maxlength characters (assuming there is one).

And I don't see why they have two ways of achieving "hard wrap (always break at exactly MAXLENGTH characters)". Perhaps when there is "no wrap", they mean to truncate at MAXLENGTH characters, not to "hard wrap".

Updated by Nathan Woodrow over 2 years ago

Alister Hood wrote:

Just to clarify: are you proposing actually doing it in the expression builder?

No. The plan is to add another control to the label dialog for wrapping properties e.g. max length, wrap character etc

This is a general labeling thing not really just for expressions.

Also available in: Atom PDF