[GRASSLIST:10227] Re: Generating non-overlapping labels
Ralf Gerlich
ralf.gerlich at bsse.biz
Thu Feb 9 10:52:53 EST 2006
Hi,
Patton, Eric schrieb:
> Hi Ralf,
>
> I was wondering the same thing...label collision avoidance is one of the few
> GIS functions that I need Arc to solve. I'm willing to try working on a
> script to provide this functionality because I need this on a daily basis; I
> suspect it's either very complex in shell scripting, or requires C
> programming. If it can be done in bash, I can take a look at it, but that's
> the limit of my abilities.
I have had a quick look at the Mapserver sourcecode doing the actual
layout, but it's a bit hard to understand in detail if one doesn't have
enough knowledge of the internal mapserver architecture.
In general, however, I think that Mapserver simply saves the - possibly
rotated - bounding boxes of previously generated labels and for each new
label tries all of the available anchors (Y: top, center, bottom, X:
left, center, right) until it finds one where the label does not
overlap. If it doesn't find an anchor whithout overlap, the label is not
displayed. At least this is what I found in the Mapserver docs.
However, Mapserver does this, knowing the current scale of the map to be
displayed. v.labels does not have this information and thus could only
do the prelayout when the text size is given in map units instead of
actual pixel size.
Actually, what is the reason for separating v.labels from d.labels?
Cheers,
Ralf
More information about the grass-user
mailing list