[mapserver-users] Line labeling

Stephen Lime steve.lime at dnr.state.mn.us
Wed Nov 7 14:07:16 PST 2001



Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Stephen Woodbridge <woodbri at mediaone.net> 11/07/01 02:17PM >>>
> Hi,

> Road labeling is a critical feature in map generation for getting good
> looking maps (but then you already know that). So, I would like to offer
> a few ideas in this regard -- some/most? of which would require some
> support in mapserver:

> 1) the merging of line segments works well toward solving this problem
> BUT at the cost of pre-processing the data, which is not so bad, but a
> bigger problem is losing important geocoding information about each line
> segment like address from and to for each side of the segment.

Disk is cheap, just keep both versions around. Line labeling is extremely
sensitive to input data. Merging segments between intersections provides
huge benefits in labeling.

> 2) prioritizing street segments could easily be don't with a simple
> code. In the Tiger/Line data every segment as a CFCC field which is the
> road class. Others might have to classify there roads if they don't have
> the equivalent.

This is a must IF you have roads of different classes in the same file. Another
strategy is store different classes seperately. The other benefit is that road
display is often scale dependent (i.e. don't show city streets at the state
level) so you may see huge performance increases, plus you can better make
use of spatial indexing.

> 3) for label generation I am guessing (haven't looked at the source yet)
> that every label placed on the map is kept in a list to check again to
> avoid collisions, if the name was also kept in the list you could check
> if you already labeled a segment of the same name within some distance
> of the previous label and reject labeling it if you already had.

This is already supported. There is a MINDISTANCE label parameter that allows
you to define a minimum distance between labels with the same value.

> 4) having the road class also allows you to easily filter when to
> display what class of roads (I think this is already implemented - I
> will find out as soon as I get my Tiger 2000 data converted and load up
> a mapserver)

Yes, this is implemented. Depending on the size of the data though it's stupid to sort
through millions of streets to display one highway. So data reorganization can really
help.

> I have implemented this labeling on my home brew server and in part on
> the Tiger Map Server and they work very nicely. The distance between
> label can be made accessable as an object attribute or config file
> param.

> Please pardon my ignorance, if I have stated something stupid or
> obvious, as I'm still feeling my way about with mapserver.

> -Stephen Woodbridge

Your suggestions are go and where applicable have already been implemented in the
code. I can't stress enough though that good labeling is the product of good data.

Steve




More information about the MapServer-users mailing list