Skip to main content
Question

Using multi-line labels with MapnikRasterizer


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

10 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • 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+17
  • Contributor
  • April 4, 2016
alexandervstepa wrote:

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+43

@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
  • 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
mark2atsafe wrote:

@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
gio wrote:

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
erik_jan wrote:

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+43
  • Safer
  • April 15, 2016
mark2atsafe wrote:

@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
  • 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)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings