[mapserver-users] state label placement and priority labelling

Walt Lin joemayfair at usa.net
Sat Jan 5 22:23:06 PST 2002


Steve and others-- i'm using this same US states layer
(nationalatlas.gov).  Is there any other way to control the position of
labels besides the auto|ll|cc... ?  None of them produce satisfactory
results for labelling the states-- funky shaped states screw up the
label placement, and states like Virginia which have two or more
disjoint polygons really screw up the placement (I can't get the
Virginia label even close to the "middle" of the state).

Also, can someone point me to the "correct" way to prioritize labeling
by some criterion?  For example, suppose I want to label the most
populous cities first, so Boston "wins" over Brookline when they
conflict, or Massachusetts gets labelled before Rhode Island in a
conflict because it is bigger?

Thanks.

Walt


On Wed, Oct 03, 2001 at 08:29:44AM -0500, Stephen Lime wrote:
> I downloaded the layer myself and will take a look. A couple of things
> off the top of my head. MINDISTANCE is given in pixels and only deals
> with duplicates. POSITION AUTO uses 8 label points that revolve around
> the label point. If you want to center directly upon the label point choose
> CC explictly. I think there may be enough info in the label cache to add
> CC back into the AUTO placement if no marker is being used, I'll file that
> as a bug in bugzilla. Finally, polygon label points are generated as follows:
> 
>   - use midpoint of bbox if that point falls in the polygon
>   - compute a centroid based on sampling the feature
> 
> For odd shaped states (like Mass. or Fla.) the position may not be optimal.
> 
> Steve
> 
> John R Frank wrote:
> 
> > Hi
> >
> > I'm trying to display a US state boundaries layer that I downloaded from
> > nationalatlas.gov.  The labels show up many times.  Even if I crank up the
> > label::mindistance and label::buffer it still shows a few and they are
> > pushed away from the center of the state!
> >
> > When I look at this layer in ArcExplorer, it looks _perfect_.  The state
> > labels appear once, centered in each state.
> >
> > How can we achieve this with mapserver?  (we love mapserver).  My states
> > layer is below.
> >
> > John
> >
> >   LAYER
> >     NAME states
> >     TYPE POLYGON
> > #    TOLERANCE 3
> >     MAXSCALE 100000000
> >     MINSCALE 10000
> >     LABELMAXSCALE 100000000
> >     LABELMINSCALE 500000
> >     LABELITEM "state"
> >     CLASS
> > #      COLOR 190 255 190
> >       BACKGROUNDCOLOR 255 255 255
> >       OUTLINECOLOR 150 150 150
> >       LABEL
> > #        ANGLE AUTO
> >         COLOR 230 0 0
> > #       OUTLINECOLOR 0 0 0
> >         TYPE TRUETYPE
> >         FONT arial
> >         SIZE 9
> >         POSITION AUTO
> >         BUFFER 7
> >   #      WRAP " "
> >         MINDISTANCE 300000000000
> >       END
> >     END
> >   END
> >
> > ~
> 
> 
> 



More information about the MapServer-users mailing list