Label cache and potting in 4.8.1
Peter Bruton
peter.bruton at NRCAN.GC.CA
Wed Jun 13 08:16:02 PDT 2007
Hello;
I am using MapServer 4.8.1 and would like to control the order in which
labels are plotted on a map. Lets say I have 2 annotation layers. One
layer has capital city labels and the second has populated place labels.
How would I ensure that all capital city labels are plotted first and then
populated place labels are plotted?
Besides the general question I have outlined in the previous paragraph I
would like to know how MapServer assembles the labelcache and then orders
labels in the cache. As I understand it MapServer 4.8.1 uses the last in
first out (LIFO) mechanism to plot labels on a map. To use the previous
paragraphs example, would I position the populated place layer second from
the bottom of my mapfile and the capital city layer at the bottom of my
mapfile so that the capital city layer is read into the cache last and thus
plotted first? I presume that once all of the capital city labels are
removed from the cache, the populated place layers are plotted.
If that is the case, how does Mapserver determine the order in which the
labels in that capital city layer are ordered in the cache and then plotted?
As I understand it, I can use the "sortshp" utility to oder the records in
a shapefile to control plotting order of labels. However, not all
shapefiles have an attribute that can be used to sort the shapefile records.
If a data set does not have an attribute that allows for the sorting of
shapefile records, how does MapServer order labels in the cache?
I am interested in understanding how MapServer's label plots labels on a
map. Suppose the LABEL object's POSITION parameter is set to AUTO. One
way that labels can be positioned is for the first label in the cache
plotted in an absolute position and never moved? Then the the second label
position is determined by any LABEL object parameters (such as BUFFER,
OFFSET, etc.) and the location of the first label. The second label now has
an absolute position and is never moved. The rest of the labels in the
cache (third, fourth, etc.) are plotted in a similar manner. Is this how
MapServer positions labels or is some other strategy used?
Any insight on how MapServer's label cache and plotting is appreciated.
Peter Bruton
More information about the MapServer-users
mailing list