Skip to main content
Question

Using multi-line labels with MapnikRasterizer

  • April 4, 2016
  • 10 replies
  • 69 views

Forum|alt.badge.img

Hi,

I am trying to create a multi-line label as a part of mapnik rendering. I use a string concatenator to for a a label (e.g. "top label" + newline + "bottom label" and then I render it along a line/segment. What happens is that label is rendered on the top of line/segment as ONE long label. Somehow, Mapnik doesn't honor my multi-line label representation. I tried it with FME Desktop 2015/2016.

What I would like to have:

text top

---------------------

text bottom

instead I have, 'text top [square symbol] text bottom' over a segment/line.

I appreciate any advice on this issue.

Thank you,

Alexander

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

10 replies

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • April 4, 2016

Have you tried using the TextStroker before the MapnikRasterizer?


Forum|alt.badge.img

Thank you for your prompt response. I am not sure if TextStroker can be helpful. I added a figure below to clarify my issue with the multi-line label - it looks that Mapnik doesn't process the new line character within the label.


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • April 4, 2016

Thank you for your prompt response. I am not sure if TextStroker can be helpful. I added a figure below to clarify my issue with the multi-line label - it looks that Mapnik doesn't process the new line character within the label.

By using the TextStroker you convert the text to a (line or polygon) geometry. I tried it and the newline is handled correctly by the TextStroker.


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • April 8, 2016

@alexandervstepa

If you use the StringConcatenator then click the Newline special character instead of typing \\n

That gives you a special character "LF" that works OK (at least it does for me in FME 2016.1)

Make sure Show Spaces/Tabs is turned on in the options of the StringConcatenator editor

The result is this:


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • April 11, 2016

A newline is actually \\r\\n

It is a carriage return followed by a linefeed.

Remember the physical type writer?

You can even choose them in the texteditor in most transformers.

A newline can indeed by picked in a stringconcatenator. (wich i don't use mouch as mostly one can acces a texteditor)


Forum|alt.badge.img

@alexandervstepa

If you use the StringConcatenator then click the Newline special character instead of typing \\n

That gives you a special character "LF" that works OK (at least it does for me in FME 2016.1)

Make sure Show Spaces/Tabs is turned on in the options of the StringConcatenator editor

The result is this:

Mark, thank you for your answer. I did exactly that in the beginning. The problem happens with multi-line labels oriented along the lines. As soon as I select a labeling around a point - everything works fine. I am not able to do multi-level labels with orientation along a line.


Forum|alt.badge.img

A newline is actually \\r\\n

It is a carriage return followed by a linefeed.

Remember the physical type writer?

You can even choose them in the texteditor in most transformers.

A newline can indeed by picked in a stringconcatenator. (wich i don't use mouch as mostly one can acces a texteditor)

Gio, thank you for your comment. I tried that as well - it looks the problem happens if the label is oriented along an edige/line - in such case Mapnik doesn't take a new line into account during label placement.


Forum|alt.badge.img

By using the TextStroker you convert the text to a (line or polygon) geometry. I tried it and the newline is handled correctly by the TextStroker.

Hi Eric,

I will try to experiment with TextStroker.

Thank you.


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • April 15, 2016

@alexandervstepa

If you use the StringConcatenator then click the Newline special character instead of typing \\n

That gives you a special character "LF" that works OK (at least it does for me in FME 2016.1)

Make sure Show Spaces/Tabs is turned on in the options of the StringConcatenator editor

The result is this:

Ah, OK. I'll test that when I'm in the office next and file a bug report with the developers.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • May 9, 2018

@alexandervstepa

hmm... at an old post again..

use an attribute splitter, explode the list.

index= 0 and index 1 seperate inputs on MNR (same geometry of course)

Ofset 1 above the line and other below.

(but thats 2 years too late...lol)