[mapserver-users] Label wrapping question

Dejan Gambin dejan.gambin at coin.hr
Wed Sep 24 06:54:29 PDT 2014


Here is my situtation - I can fit max 20 chars in my layout. For me, it seems logical to define maxlength of 20 and not worry any more because this is indeed my maximum, and anything above this must be cut. Since it cuts on the word boundary (by setting wrap character to space), it must should cut before.

Anyway, here are some screen captures. In "before" situation, I had to adjust maxlength (from 20 to 15 to 13) to get good enough result. In "after" situation, I just put maxlength to 20 and it seems ok.

Btw, this is just the proof of concept. I didn't make change for label->encoding part, and also, it currently crashes in certain situation if I have a word in label text longer than maxlength. It should all be revised and modified.

regards, dejan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: After_maxlength20.png
Type: image/png
Size: 66443 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140924/e1ef6071/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Before_maxlength13.png
Type: image/png
Size: 62580 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140924/e1ef6071/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Before_maxlength15.png
Type: image/png
Size: 61262 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140924/e1ef6071/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Before_maxlength20.png
Type: image/png
Size: 53958 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140924/e1ef6071/attachment-0007.png>
-------------- next part --------------


On 24. ruj. 2014., at 15:15, Rahkonen Jukka (Tike) wrote:

> Hi,
> 
> Send us some screen captures  of wrapped labels before and after your change. I feel that your change would make sense.
> 
> -Jukka Rahkonen-
> 
> Dejan Gambin wrote:
> 
>> In the meantime, I have slightly changed msWrapText() function in maplabel.c to
>> get what I wanted. If someone is interested I can share the short piece of code.
>> 
>> regards, dejan
>> 
>> 
>> On 23. ruj. 2014., at 12:32, Dejan Gambin wrote:
>> 
>>> Hi,
>>> 
>>> I have some users wishing to use long legend labels, but they don't fit well on
>> my site. As I can see, MapServer is doing this - if maxlength > 0 and wrap = 'char'
>> (usually space), insert a new line at the FIRST wrap character found AFTER
>> maxlength character. This is leading to some bad results (label not wrapped or
>> wrapped too early).
>>> 
>>> My question is - shouldn't it be better to wrap at the LAST wrap character
>> BEFORE maxlength character? Is this maybe implemented somewhere or there
>> are plans for this?
>>> 
>>> Thanks very much
>>> 
>>> regards, dejan
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
>> _______________________________________________
>> 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