Symbol Sets

Synopsis:The MapServer comes with 3 default symbol files which are located in the symbols sub-directory of the distribution. The files are called shade.sym, line.sym, and marker.sym and may be edited or replaced at your leisure provided the names remain the same. Note that symbol 0 is always the degenerate case for a particular class of symbol. For points, symbol 0 is a single pixel, for shading (i.e. filled polygons) symbol 0 is a solid fill, and for lines, symbol 0 is a single pixel wide line.

Notes: Symbol files contain no information about colors. Color information is set within a class definition in the mapfile.

Utilities: Included with the distribution is a utility called sym2gif which will create a GIF/PNG file from a symbol file. Run the program with no arguments to get the syntax.

Format: Symbol files are ASCII text files. A symbol file must start with one of the following keywords: SHADESET, LINESET or MARKERSET that defines the type of symbols that follow. The file must end with the keyword end. Here's the general format:

MARKERSET|SHADESET|LINESET

Symbol
(options)
END # Symbol

(more symbols)

END # Symbol file

Shade and marker symbols have identical symbol formats and options, line symbols have a few additional options. At present the maximum number of symbols in a file is 31. This can be increase (or decreased) by editing mapsymbol.c and bumping the appropriate #defines at the top of the file.

Shade and Marker Symbols

  • Type [VECTOR|ELLIPSE|PIXMAP]: The identifiers mean the following:
  • VECTOR: a simple drawing is used to define the shape of the symbol.
  • ELLIPSE: radius values in the x and y directions define an ellipse.
  • PIXMAP: a user supplied GIF image will be used as the symbol.
  • Points: Signifies the start of the definition of points that make up a VECTOR symbol or that define the x and y radius of an ELLIPSE symbol. Here's an example that defines a simple triangle VECTOR symbol:
  • The end of points is signified with the keyword END. Coordinates are given in pixels and define the default size of the symbol before any scaling. In the above example the triangle would be 5x5 pixels in size by default. At present, the limit on number of points is 100. This can be increase (or decreased) by editing mapsymbol.c and bumping the appropriate #defines at the top of the file.

    You can create non-continuous paths by inserting negative coordinates at the appropriate place. Here's an example that defines a simple VECTOR cross or plus sign:

    For ELLIPSE symbols you provide a single point that defines the x and y radius of an ellipse. Circles are created when x and y are equal.

    Filled: sets symbol so that it is filled with a user defined color (see mapfile documentation for more information on colors). For marker symbols, if outlineColor was specified in the mapfile then the symbol is outlined with it.

    Transparent [color index]: sets a transparent color for the input GIF image for PIXMAP symbols, or determines whether all shade symbols should have a transparent background. For shade symbols it may be desireable to have background features"show through" a transparent hatching pattern, creating a more complex map. Here's an example:

    By default a symbols background is the same a the parent image (i.e. color 0). This is user configurable.

  • Image [filename]: full pathname of GIF file to use for a marker or shade fill. PIXMAP symbols can not be scaled. The main image colormap is loaded prior to the use of any PIXMAP symbols. If there is not enough room for the additional colors in the GIF file then the closest color(s) from the main image will be used. In cases with many colors this can result in some strange looking images.
  • Line Symbols

    Line symbols support all the options detailed above. Only new options are detailed below.

  • Type [VECTOR|ELLIPSE|PIXMAP|STYLED]: STYLED lines are essentially lines made up of multiple lines with varying offsets and dash patterns.
  • Style: Signifies the start of a line style definition. It is followed by an offset, on dash length, and an off dash length that define individual lines in the style. For STYLED types upto 11 line styles may be defined. The Style section is terminated with the keyword END. Units for dash lengths and offset are in pixels. Drawing line styles is somewhat of an inexact science. The MapServer uses a simple, imperfect, algoritm to offset lines and certain symbols can degenerate at sharp turns.

  • Anyway, here are a couple of examples: