[mapserver-dev] Need Better highway labeling for multiple names and labels

Stephen Woodbridge woodbri at swoodbridge.com
Thu Feb 24 11:05:54 EST 2011


Alan,

The thing that I keep hitting on when I think about this family of 
problems is that all our efforts come back to how to control the label 
points. All the use cases come back to this one issue. In PostGIS the 
linear referencing functions use the concept of a percentage along the 
line, ie: 0 through 1.0 for start to end of the LINESTRING.

So long term it would be very useful to be able to define a point along 
a linestring and then to be able to use it as the REPEATOFFSET anchor 
point or as a label point, etc.

The GEOMTRANSFORM could be used here, but you would not want to loose 
the LINESTRING info because you might want to say something like:

LABELPOINT 0.1  # 10% from the start of the linestring
ANGLE AUTO      # Align the angle with the vector of the linestring
                 # the point is on
OFFSETXY 0 12   # x is along the vector, +y is normal to the left
                 # -y is normal to the right as you walk along the vector

So if we had something like LABELPOINT this could be used to define the 
anchor point for REPEATDISTANCE or as the label point if we were not 
repeating. So currently, we calculate a label point and if the 
LABELPOINT was not there we would continue as before, but if it exists, 
we use that to calculate the point.

This would also have the side effect of anchoring the label on the 
linestring rather that have it floating as the linestring gets clipped 
by the view or in tiles which has significant value in some situation as 
mentioned.

I think that most or all of my example able would then work if this were 
implemented. I'm not sure if this mucks with too much code, but I think 
it would be a very useful pattern if it would work.

Thanks for your research on this.

-Steve W

On 2/24/2011 10:01 AM, Alan Boudreault wrote:
> Steve,
>
> Yes it would be feasible to add a repeatoffset to do so. I think it would be
> relatively simple.
>
> Alan
>
> On February 14, 2011 11:36:32 am Lime, Steve D (DNR) wrote:
>> Steve: I’m assuming on the data side you have multiple road name attributes
>> for each road segment.
>>
>> Thinking about this I would approach this by augmenting the REPEATDISTANCE
>> operations with a new REPEATOFFSET (default is 0). That way you could add
>> a second set of labels to the same set of geometries with some hope that
>> labels would not collide. I would think this would work best with labels
>> that are of a consistent size, like road shields.
>>
>> Then from a mapfile perspective you’d draw things twice, in 6.0 it would
>> look like:
>>
>> LAYER
>>    NAME ‘highway1’
>>    TYPE LINE
>>    LABELITEM ‘road_name1’
>>    # classes follow using label styles to draw the shields and class styles
>> to draw the linework and no repeat offset END
>>
>> LAYER
>>    NAME ‘highway2’
>>    TYPE ANNOTATION
>>    LABELITEM ‘road_name2’
>>    # classes follow using class styles to draw the shields with a repeat
>> offset END
>>
>> So, highway1 would lay down the line work and one set of shields and
>> highway2 would draw a second set of shields offset from the first.
>>
>> Another idea might be to allow multiple class expression matches. It might
>> be possible to do what you want using one layer definition if a feature
>> could match multiple classes. So you’d have one set for road_name1, one
>> for road_name2, one for road_name3. The set for road_name1 would always
>> draw line work and a first set of shields, the subsequent would do only
>> shields. I’ve never used CLASSGROUPs so perhaps this concept is already
>> supported.
>>
>> In either case you’d need REPEATOFFSET. Alan could comment on the
>> feasibility of adding that.
>>
>> Doing things like multiple labels or label items is too disruptive IMHO…
>>
>> Steve
>>
>>
>> From: mapserver-dev-bounces at lists.osgeo.org
>> [mailto:mapserver-dev-bounces at lists.osgeo.org] On Behalf Of Tamas Szekeres
>> Sent: Saturday, February 12, 2011 4:20 PM
>> To: Stephen Woodbridge
>> Cc: mapserver-dev
>> Subject: Re: [mapserver-dev] Need Better highway labeling for multiple
>> names and labels
>>
>> Steve,
>>
>> Wouldn't that be feasible to utilize the REPEATDISTANCE as per
>> MS-RFC-57<http://mapserver.org/development/rfc/ms-rfc-57.html>  to define
>> the positions? In this case we could define some special character as a
>> separator to split the labeltext into fragments that could be alternated
>> in the subsequent positions.
>>
>> Best regards,
>>
>> Tamas
>>
>>
>> 2011/2/12 Stephen Woodbridge
>> <woodbri at swoodbridge.com<mailto:woodbri at swoodbridge.com>>  Hi all,
>>
>> I just wrote and enhancement request:
>>
>> http://trac.osgeo.org/mapserver/ticket/3675
>>
>> I would be interested in some feedback on this and if anyone has ways to
>> work around these limitations.
>>
>> Best regards,
>>   -Steve W
>> _______________________________________________
>> mapserver-dev mailing list
>> mapserver-dev at lists.osgeo.org<mailto:mapserver-dev at lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>



More information about the mapserver-dev mailing list