[mapserver-users] Line labeling

Stephen Woodbridge woodbri at mediaone.net
Wed Nov 7 15:17:47 EST 2001


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.

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.

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.

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)

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

Paul Ramsey wrote:
> 
> It is not a pleasant solution, but it works very well. I processed my
> road network so roads were not broken by intersection, and roads of a
> certain name were made up of as few segments as possible. So rather than
> having 12 "Main St" segments, broken at cross streets, I just had one.
> This made the labelling much more aesthetically pleasing, since I would
> only ever get one instance of a particular name on the map at any time.
> Sorting the dataset by road length then should also give you a "by
> importance" order as well, sort of.
> 
> Alexander Pucher wrote:
> >
> > Hi,
> >
> > in one of our mapserver-applications, we tried to label line objects of
> > a city map - no problem. We use a truetype font, autorotate and a
> > minFeatureSize. The problem is, that the line segments of main streets
> > between 2 side streets are often too short, so the main street is not
> > labeled at all. Small side streets, which are longer than minFeatureSize
> > get labeled!
> >
> > Any idea, how we get the streets labeled in a correct way, let's say by
> > importance??
> >
> > mfg
> > ALEX
> >
> > --
> > ________________________________________________________
> >
> > Institut fuer Geographie und Regionalforschung
> > Universität Wien
> > Kartografie und Geoinformation
> >
> > Departement of Geography and Regional Research
> > University of Vienna
> > Cartographie and GIS
> >
> > Universitaetstr. 7, A-1010 Wien, AUSTRIA
> >
> > Tel: (+43 1) 4277 48644
> > Fax: (+43 1) 4277 48649
> > E-mail: pucher at atlas.gis.univie.ac.at
> >
> > FTP: ftp://ftp.gis.univie.ac.at
> > WWW: http://www.gis.univie.ac.at/karto
> > ________________________________________________________
> >
> > "He that will not apply new remedies must expect new evils; for time is the greatest innovator"--Francis Bacon
> >
> >
> 
> --
>       __
>      /
>      | Paul Ramsey
>      | Refractions Research
>      | Email: pramsey at refractions.net
>      | Phone: (250) 885-0632
>      \_



More information about the mapserver-users mailing list