.. index:: single: Symbology examples .. _sym_examples: ***************************************************************************** Symbology Examples ***************************************************************************** :Author: Jeff McKenna :Contact: jmckenna at gatewaygeomatics.com :Author: HÃ¥vard Tveite :Contact: havard.tveite at umb.no :Date: $Date$ :Revision: $Revision$ :Last Updated: 2011/05/11 .. contents:: Table of Contents :depth: 2 :backlinks: top Example 1. Dashed Line --------------------------------------------- This example creates a dashed line that is 5 `SIZEUNITS` wide, with 10 `SIZEUNITS` on, 5 off, 5 on, 10 off ... .. code-block:: mapfile LAYER ... CLASS ... STYLE COLOR 0 0 0 WIDTH 5 LINECAP butt PATTERN 10 5 5 10 END END END END Example 2. TrueType font marker symbol --------------------------------------------- This example symbol is a star, used to represent the national capital, hence the name. The font name in defined in the :ref:`FONTSET` file. The code number "114" varies, you can use MS Windows' character map to figure it out, or guestimate. .. code-block:: mapfile SYMBOL NAME "natcap" TYPE TRUETYPE FONT "geo" FILLED true ANTIALIAS true # only necessary for GD rendering CHARACTER "r" END Example 3. Vector triangle marker symbol --------------------------------------------- This example is fairly straight forward. Note that to have 3 sides you need 4 points, hence the first and last points are identical. The triangle is not filled. .. code-block:: mapfile SYMBOL NAME "triangle" TYPE vector POINTS 0 4 2 0 4 4 0 4 END END Example 4. Non-contiguous vector marker symbol (Cross) ------------------------------------------------------- This 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. .. code-block:: mapfile SYMBOL NAME "cross" TYPE vector POINTS 2.0 0.0 2.0 4.0 -99 -99 0.0 2.0 4.0 2.0 END END Example 5. Circle vector symbol --------------------------------------------- This example creates a simple filled circle. Using non-equal values for the point will give you an actual ellipse. .. code-block:: mapfile SYMBOL NAME "circle" TYPE ellipse FILLED true POINTS 1 1 END END Example 6. Downward diagonal fill --------------------------------------------- This example creates a symbol that can be used to create a downward diagonal fill for polygons. .. code-block:: mapfile SYMBOL NAME "downwarddiagonalfill" TYPE vector TRANSPARENT 0 POINTS 0 1 1 0 END END Example 7. Using the Symbol Type HATCH (new in 4.6) ---------------------------------------------------- As of MapServer 4.6, you can use the symbol type HATCH to produce hatched lines. The following will display hatched lines at a 45 degree angle, 10 `SIZEUNITS` apart (center to center), and 3 `SIZEUNITS` wide. Symbol definition: .. code-block:: mapfile SYMBOL NAME 'hatch-test' TYPE HATCH END Layer definition: .. code-block:: mapfile 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: MINSIZE, MAXSIZE, MINWIDTH, and MAXWIDTH. Example 8. Styled lines using GAP ---------------------------------------------------- This example shows how to style lines with symbols. A 5 `SIZEUNITS` wide black line is decorated with ellipses that are 15 `SIZEUNITS` long (and 7.5 `SIZEUNITS`wide). The ellipses are placed 30 `SIZEUNITS` apart, and the negative `GAP` value ensures that the ellipses are oriented relative to the direction of the line. The ellipses are rotated 30 degrees counter clock-wise from their position along the line. Symbol definition: .. code-block:: mapfile SYMBOL NAME "ellipse2" TYPE ellipse FILLED true POINTS 1 2 END END Layer definition: .. code-block:: mapfile LAYER ... CLASS ... STYLE WIDTH 5 COLOR 0 0 0 END STYLE SYMBOL 'ellipse2' COLOR 0 0 0 ANGLE 30 SIZE 15 GAP -30 END END END