[mapserver-users] multiline label and two problems(different font sizes, avoid overlapping)

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Sat Nov 6 10:34:26 EDT 2010


Hi Cris: This is a tough nut to crack. You can't do within text formatting which leaves your current approach. There's no
way to really do this absolutely reliably I'm afraid. Drawing twice is your only option. Here are some ideas to make it
more robust:

  - With FORCE TRUE you should be able to tweak the offsets based on a set POSITION (e.g. CC) so that both labels will display

  - With FORCE FALSE (the default) you can then play with the BUFFER value to reserve space around the labels. The trick is
    to use a negative value, that allows labels to get really close to one another, you can even allow a little overlap. The value is
    given in pixels.

  - Use label PRIORITY to get the labels for these features in the same "batch". This means the two sets of labels will be processed
    at the same time. If given the highest priority you can avoid collisions with other labels and maximize the chance of seeing both.

One last idea would be to create a special labeling version of your data. You'd store each point in the dataset twice, one right after
the other and add an attribute to say which point should be labeled with label scheme 1 vs. label scheme 2. Then you'd use different
CLASSes based on that new attribute. The data would have to be sorted so the features would draw one right after the other. The
idea is to get the two labels right next to one another in the label cache. That would greatly increase the chances of being drawn
together.

All that said, if there's a lot of potential overlap between the features/labels you're trying to do this for then I think you're still going
to be dealing the partials a lot. If the features are scattered then you have a chance.

Steve

________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] On Behalf Of cris [oanacristina22 at gmail.com]
Sent: Thursday, November 04, 2010 2:18 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] multiline label and two problems(different font sizes, avoid overlapping)

Hi there!

I am trying to obtain a multi-line label , by concatenating two fields
([name 1],[name2]) from a point shapefile . This was obtained by using TEXT
([name 1]=[name2]), "=" being my wrapping character and using FORCE OFF and
POSITION set to AUTO to avoid overlapping. The beauty comes when I try to
get different font sizes for the two lines.
I stopped concatenating fields with TEXT and just labeled the  same point
twice with an OFFSET to get my 2-line label with different font sizes. The
problem this time is that these labels are set to FORCE OFF to avoid massive
cramming (POSITION was set to CC). Therefore, sometimes just [name1] is
displayed and sometimes just [name2], rarely the two together. If I change
them to FORCE ON, the labels are badly overlapping

So how could I solve this problem of having a 2-line label from a point
shapefile, lines with different font sizes and avoid overlapping, having the
same items displayed?
Any ideas are much appreciated!

Thanks a lot!

Cris
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/multiline-label-and-two-problems-different-font-sizes-avoid-overlapping-tp5704351p5704351.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list