[mapserver-users] point labels conflict with other dots, not other labels

Stephen Lime steve.lime at dnr.state.mn.us
Wed Jan 16 12:44:22 PST 2002


With "TYPE POINT" the markers themselves are considered paramount and every effort is
made not to allow labels to obscure other points. I think that's what you're running into. Keep
in mind that all of the markers are laid down first and labels are placed around them. What
you probably want is to use "TYPE ANNOTATION". In that case the label and the marker are
considered as one entity and unless both can be placed on the map without colliding with
previously placed markers/labels they won't be placed. In this case markers are laid down
with the label so there is far more room to put stuff (at the begining).

That said, the key to getting things on the map according to some parameter (say population)
is to control how they are placed into the label cache. You do that by sorting your shapefile.
Let's say you sort cities by population in ascending order. That means big cities will be placed
in the cache AFTER small one. Since MapServer steps through the cache backwards the large
cities will be rendered first and small ones only placed if there is room. The label cache covers
ALL layers so moving backwards also means that the last layers in the mapfile are labeled first.
Often this means that you might store feature names in a seperate layer than the feature is
rendered in.

Steve

Stephen Lime
Data & Applications Manager

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

>>> Walt Lin <joemayfair at usa.net> 01/13/02 01:30AM >>>
Hi-- I have a problem with the way mapserver labels my cities layer
for the US (points).  I'm trying to get good priority labelling-- ie at
higher levels, the more important cities show up.  So here's the
problem: it seems that mapserver won't draw the label for a point if
that label will conflict with another red dot representing a city
point-- *NOT* another city *label*, which is what I want.

e.g.:  St. Paul and Minneapolis are right next to each other, so
mapserver won't label either of them, because each of those labels
conflicts with the dot representing the other city.  However, I would
like mapserver to label one of them (the most populous), and then not
label the other because it would conflict with the first *label*.

I've tried combinations of LABELCACHE and POSTLABELCACHE but those don't
do what I would like.

Can I accomplish this?  Any suggestions?  Besides deleting points that
are close together, because I want to keep all the red dots.

Also, without reading code (or, could Steve/someone else point me to
where in the code I should start reading), could anyone explain briefly
how mapserver does the labelling conflicts, especially with multiple
layers?  Does it just start last layer first, drawing labels that don't
conflict with any drawn features or other drawn labels, and move towards
the first layer?

Thanks.
Walt




More information about the MapServer-users mailing list