Question about OFFSET values

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Sat Dec 10 12:32:21 EST 2005


Blammo wrote:
> Stephen,
> 
> I won't be able to get back to it again  till Monday.
> 
> There seems to be a few different possible approaches to this.
> 
> I'm not so sure it needs to be thought of as a bug as of yet.  It really 
> is a specialized labelling need at the moment. Not surehow many other 
> might need to do something like this, at least very often. Your 
> suggestion below might be an alternative that could work too.  Although 
> I like the finer control of the OFFSET parameter which is a pixel level 
> vs a character spacing.

Yes, finer control would be better, but cutting the number of layers in 
half improves efficiency if that becomes a concern.

> One problem I know I'm not going to avoid is when a curved street 
> segment is encountered.  While these types of lines are in the minority 
> of the dataset, they won't label correctly if I push the labels out to 
> the ends of the line because all the positioning of the labels will be 
> dependent on the central sub-line element of the multipart line 
> segment.  This is why I've settled on the more central line labels.  The 
> readability problem comes into play when the line segment being labelled 
> is on the short side and the labels start to overlay the nearby labels 
> of other line segments.

This problem would be resolved if we could define the location of the 
label point as a percentage [0.0 - 1.0] along the line. If the line is 
clipped in the view we would have to define if the percent is relative 
the the viewed segment or the unclipped line.

> Since I have all these labels so close to each other, all the label 
> interference parameters seem to do is turn everything off if they are 
> used.  I'm still testing on this stuff though.  One thought would be the 
> possible addition of a parameter to stop labelling a line below a 
> certain (sub-) segment length, but there's a possibility that some 
> segments might never get labelled no matter how far you zoom in.

I think this is also a problem using offsets, in that you can not push 
the labels to the ends using offsets because line lengths vary. It would 
be desirable to be able to specify the label point for a line also so 
you can put the address ranges on the ends of the line and leave space 
for the street name at the center of the line.

> To tell the truth, this is really related more to wrapping labelling 
> around a curve, which I know has been mentioned in the past as a desired 
> option.   Adding this capability in though seems to be a bit harder to 
> accomplish than fiddling with the current settings to get something 
> close, which I've done already, see below

If the label point always picks up the angle of the line segment the 
label point falls on the the curved line segment will work as expected 
and the labels at each end will stay aligned with the ends.

I guess I need to try this. So I assume that the offsets work relative 
to the rotated label and not the image X-Y axis. Cool, I just noticed 
that you have MULTIPLE labels for a single layer. I didn't know you 
could do that. ... I love mapserver!!!

Thanks,
   -Steve

> LABEL
>  ANGLE AUTO
>  POSITION LL
>  TEXT "[L_FROM]"
>    OFFSET 10 5  ## it's interesting that these numbers don't need to be 
> negative like I thought at first.
>  ...
> END
> LABEL
>  ANGLE AUTO
>  POSITION UL
>  TEXT "[L_TO]"
>    OFFSET 10 5
>  ...
> END
> LABEL
>  ANGLE AUTO
>  POSITION LR
>  TEXT "[R_FROM]"
>    OFFSET 10 5
>  ...
> END
> LABEL
>  ANGLE AUTO
>  POSITION UR
>  TEXT "[R_TO]"
>    OFFSET 10 5
>  ...
> END
> 
> bobb
> 
> Stephen Woodbridge wrote:
> 
>> Hi Bob,
>>
>> Would you post what you have done so far? I have wanted to do 
>> something like this for a long while.
>>
>> Have you, would you open a bug for an enhancement to mapserver to 
>> better support this functionality?
>>
>> You might be able to get this to work with two layers by:
>>
>> LABEL
>>   ANGLE AUTO
>>   POSITION CC
>>   TEXT "[L_FROM] [R_FROM]"
>>   WRAP " "
>>   ...
>> END
>>
>> Then you can vary the number of spaces between the two fields based on 
>> the line thickness and then use the OFFSETs to get them positioned on 
>> the line.
>>
>> It would be nice if POSITION could take a percentage along the line 
>> segment as the label point. So 0.0 would be the start of the line and 
>> 1.0 would be the end of the line and the angle would be based on which 
>> part of the polyline that the label point fell on.
>>
>> -Steve W.
>>
>> Bob Basques wrote:
>>
>>> All,
>>>
>>> Ok, I got my addressing range labels too llok pretty good using four 
>>> Layers with seperate LABELITEMS and OFFSETS.
>>>
>>> Now I need to figure out a way, if possible, to scale the OFFSET 
>>> values based on the overall length of the line.
>>>
>>> Can I use a value, line length, and a percentage of line length to 
>>> use for the Offset values of the labels.  Right now the labels are 
>>> situated for the most part near the center of the line.  I would like 
>>> to puch the labels out to the ends of the lines for example, or pull 
>>> them in closer for longer and shorter line segments.
>>>
>>> This is purely an exercise in readability right now, what I have 
>>> seems to be working great for the customer.  Thanks for the pointers 
>>> I got last week.
>>>
>>> bobb
>>>
>>
>>
> 



More information about the mapserver-users mailing list