MapServer LAYER>CLASS>LABEL Object

The Label class can allow for multiple columns to form an Expression for the label.  For full details of the MapServer LAYER>CLASS>LABEL Object please see the MapServer MAP Documentation

The example below shows fields TYPE + DATEOPENED + TIMEOPENED to all be used.

The output is “(33) 12-03-1970 1400hrs”

  TEXT (([TYPE]) [DATEOPENED] [TIMEOPENED]hrs)
   LABEL
      FONT "arialbd"
      TYPE TRUETYPE
      COLOR 0 128 0
      OUTLINECOLOR 255 255 255
      SIZE 9
      POSITION cr
      ANTIALIAS TRUE
   END

 

To add specific text as a LABEL (e.g. “No Aerial Photography Available” in areas without data), use the following additions:

To the LABEL node - used to specify the character to define line-breaks in the text.

LABEL
     WRAP "¬"
END

 

To the CLASS node - used to define specific text to display (i.e. when not taken from a field in the layer)

CLASS
     TEXT "Sorry...¬No Aerial¬Photography¬Available..."
END

Notice the use of the "¬" char (specified above) to denote line-breaks in the text.