Home | Docs | Issue Tracker | FAQ | Download
MapServer logo

Table Of Contents

Previous topic

Cartographic Symbol Construction with MapServer

Next topic

Templating

This Page

Quick search

Enter search terms or a module, class or function name.

Symbology Examples

Author:Jeff McKenna
Contact:jmckenna at gatewaygeomatics.com
Revision:$Revision: 8295 $
Date:$Date: 2008-12-26 21:08:04 -0800 (Fri, 26 Dec 2008) $
Last Updated:2008/07/16

The following example creates a dashed line with 10 pixels on, 5 off, 5 on, 10 off ...

Example 1. Dashed Line

SYMBOL
  NAME 'dashed1'
  TYPE ELLIPSE
  POINTS 1 1 END
  FILLED true
  PATTERN 10 5 5 10 END
END

The next example symbol is a star, used to represent the national capital, hence the name. The font name in defined in the FONTSET file. The code number “114” varies, you can use MS Windows’ character map to figure it out, or guestimate.

Example 2. TrueType font marker symbol

SYMBOL
  NAME "natcap"
  TYPE TRUETYPE
  FONT geo
  FILLED true
  ANTIALIAS true
  CHARACTER "r"
END

The next example is fairly straight forward. Note that to have 3 sides you need 4 points, hence the first and last points are identical.

Example 3. Vector triangle marker symbol

SYMBOL
  NAME "triangle"
  TYPE vector
  POINTS
    0 4
    2 0
    4 4
    0 4
  END
END

The next example draws a cross, that is 2 lines (vectors) that are not connected end-to-end (Like the triangle in the previous example). The negative values separate the two.

Example 4. Non-contiguous vector marker symbol (Cross)

SYMBOL
  NAME "cross"
  TYPE vector
  POINTS
    2 0
    2 4
    -99 -99
    0 2
    4 2
  END
END

The next example creates a simple filled circle. Using non-equal values for the point will give you an actual ellipse.

Example 5. Circle vector symbol

SYMBOL
  NAME "circle"
  TYPE ellipse
  FILLED true
  POINTS
    1 1
  END
END

Example 6. Downward diagonal fill

SYMBOL
  NAME "downwarddiagonalfill"
  TYPE vector
  TRANSPARENT 0
  POINTS
    0 1
    1 0
  END
END

The next example creates a dashed line with 10 pixels on, 5 off,... The line will have butt caps and short miter joins. For layers with a scaled symbol (SYMBOLSCALE, MINSIZE, MAXSIZE, ...) the PATTERN will be resized to maintain symbol ratios.

Example 7. Dashed Cartoline symbol

SYMBOL
  NAME "cartoline"
  TYPE cartoline
  LINECAP butt
  LINEJOIN miter
  LINEJOINMAXSIZE 1
  PATTERN 10 5 END
END

Example 8. Using the Symbol Type HATCH (new in 4.6)

As of MapServer 4.6, you can now use the symbol type HATCH to produce hatched lines. The following will display hatched lines at a 45 degree angle, 10 pixels apart, and 3 pixels wide.

Symbol definition:

SYMBOL
  NAME 'hatch-test'
  TYPE HATCH
END

Layer definition:

LAYER
  ...
  CLASS
    ...
    STYLE
      SYMBOL 'hatch-test'
      COLOR 255 0 0
      ANGLE 45
      SIZE 10
      WIDTH 3
    END
  END
END

Other parameters available for HATCH are: ANGLEITEM, SIZEITEM, MINWIDTH, and MAXWIDTH.