This project has moved. For the latest updates, please go here.

Multi-Line Labels

Topics: Algorithms, SharpMap v2.0
May 29, 2008 at 10:47 PM
Hello all, I am relatively new to SharpMap coming from working with MapPoint.  My SharpMap knowledge is limited to about a weeks worth of playing with the example code for V2. I have 2 questions:
  1. Is there a way to render a multi-line label? I am displaying symbols with a labels containing the Unit Name and Unit Status.  This should be on separate lines.
  2. Is there a way to have multiple columns combined to render a single label.
The way that I am thinking of approaching this is to have 2 label layers with one being displayed at the top the other at the bottom.  Does anyone have a better solution?

May 29, 2008 at 11:52 PM
Hi dsjames,

I haven't tried rendering labels over multiple lines myself.  Presumably GraphicsPath.AddString (which is used for rendering labels in v0.9) will accept a System.Environment.NewLine in the label string.

For joining multiple columns in v.0.9, SharpMap.Layers.Label.GetLabelMethod() can be used.



May 30, 2008 at 3:23 AM
Thanks Ben,
That worked. a simple \n in the label column will create a multi-line label.  Additionally, the GetLabelMethod() also works..
Finally, the multiple layers also look good a well particularly with 2 different colors.

D.S. James