![]() |
Home | Docs | Issue Tracker | FAQ | Download |
![]() ![]() ![]() ![]() ![]() |
Style holds parameters for symbolization and styling. Multiple styles may be applied within a CLASS or LABEL.
This object appeared in 4.0 and the intention is to separate logic from looks. The final intent is to have named styles (Not yet supported) that will be re-usable through the mapfile. This is the way of defining the appearance of an object (a CLASS or a LABEL).
Angle, given in degrees, to rotate the symbol (counter clockwise). Default is 0 (no rotation). If you have an attribute that specifies angles in a clockwise direction (compass direction), you have to adjust the angle attribute values before they reach Mapserver (360-ANGLE), as it is not possible to use a mathematical expression for ANGLE.
For points, it specifies the rotation of the symbol around its center.
For decorated lines, the behaviour depends on the value of the GAP element.
For polygons, it specifies the angle of the lines in a HATCH symbol (0 - horizontal lines), or it specifies the rotation of the symbol used to generate the pattern in a polygon fill (it does not specify the rotation of the fill as a whole). For its use with hatched lines, see Example #7 in the symbology examples.
[attribute] was introduced in version 5.0, to specify the attribute to use for angle values. The hard brackets [] are required. For example, if your data source has an attribute named “MYROTATE” that holds angle values for each feature, your STYLE object for hatched lines might contain:
STYLE
SYMBOL 'hatch-test'
COLOR 255 0 0
ANGLE [MYROTATE]
SIZE 4.0
WIDTH 3.0
END
The associated RFC document for this feature is MS RFC 19: Style & Label attribute binding.
The AUTO keyword was added in version 5.4, and currently only applies when coupled with the GEOMTRANSFORM keyword.
Note
Rotation using ANGLE is not supported for SYMBOLs of TYPE ellipse with the GD renderer (gif).
ANGLE[attribute] must now be used instead.
Deprecated since version 5.0.
COLOR [r] [g] [b] | [attribute]
Color to use for drawing features. r, g and b shall be integers [0..255]. To specify green, the following is used:
COLOR 0 255 0[attribute] was introduced in version 5.0, to specify the attribute to use for color values. The hard brackets [] are required. For example, if your data set has an attribute named “MYPAINT” that holds color values for each record, use: object for might contain:
COLOR [MYPAINT]The associated RFC document for this feature is MS RFC 19: Style & Label attribute binding.
GAP specifies the distance between SYMBOLs (center to center) for decorated lines and polygon fills in layer SIZEUNITS. For polygon fills, GAP specifies the distance between SYMBOLs in both the X and the Y direction. For lines, the centers of the SYMBOLs are placed on the line. As of MapServer 5.0 this also applies to PixMap symbols.
When scaling of symbols is in effect (SYMBOLSCALEDENOM is specified for the LAYER), GAP specifies the distance in layer SIZEUNITS at the map scale 1:SYMBOLSCALEDENOM.
Symbols can be rotated using ANGLE.
New in version 6.0: moved from SYMBOL
Note
The behaviour of GAP has not been stable over time. It has specified the amount of space between the symbols, and also something in between the amount of space between the symbols and the center to center distance. The goal is to have GAP specify the center to center distance, but in version 6.0 it is the amount of space between the symbols that is specified.
Used to indicate that the current feature will be transformed before the actual style is applied. Introduced in version 5.4.
Sets the line cap type for lines. Default is round. See Cartographical Symbol Construction with MapServer for explanation and examples.
New in version 6.0: moved from SYMBOL
Sets the line join type for lines. Default is round. See Cartographical Symbol Construction with MapServer for explanation and examples.
New in version 6.0: moved from SYMBOL
LINEJOINMAXSIZE [int]
Sets the max length of the miter LINEJOIN type. The value represents a coefficient which multiplies a current symbol size. Default is 3. See Cartographical Symbol Construction with MapServer for explanation and examples.
New in version 6.0: moved from SYMBOL
Geometry offset values in layer SIZEUNITS.
When scaling of symbols is in effect (SYMBOLSCALEDENOM is specified for the LAYER), OFFSET gives offset values in layer SIZEUNITS at the map scale 1:SYMBOLSCALEDENOM.
An OFFSET of 20 40 will shift the geometry 20 SIZEUNITS to the left and 40 SIZEUNITS down before rendering.
For lines, an OFFSET of n -99 will produce a line geometry that is shifted n SIZEUNITS perpendicular to the original line geometry. A positive n shifts the line to the right when seen along the direction of the line. A negative n shifts the line to the left when seen along the direction of the line.
Opacity to draw the current style (applies to 5.2+, AGG Rendering Specifics only, does not apply to pixmap symbols)
OUTLINECOLOR [r] [g] [b] | [attribute]
Color to use for outlining polygons and certain marker symbols (ellipse, vector and truetype). Has no effect for lines. The width of the outline can be specified using WIDTH. If no WIDTH is specified, an outline of one pixel will be drawn. r, g and b shall be integers [0..255]. To specify green, the following is used:
OUTLINECOLOR 0 255 0 WIDTH 3.0[attribute] was introduced in version 5.0, to specify the attribute to use for color values. The hard brackets [] are required. For example, if your data set has an attribute named “MYPAINT” that holds color values for each record, use: object for might contain:
OUTLINECOLOR [MYPAINT]The associated RFC document for this feature is MS RFC 19: Style & Label attribute binding.
PATTERN [double on] [double off] [double on] [double off] ... END
Currently used to defines a dash pattern for line work (lines, polygon outlines, ...). The numbers (doubles) specify the lengths of the dashes and gaps of the dash pattern in layer SIZEUNITS.
When scaling of symbols is in effect (SYMBOLSCALEDENOM is specified for the LAYER), the numbers specify the lengths of the dashes and gaps in layer SIZEUNITS at the map scale 1:SYMBOLSCALEDENOM.
To specify a dashed line that is 5 units wide, with dash lengths of 5 units and gaps of 5 units, the following style can be used:
STYLE COLOR 0 0 0 WIDTH 5.0 LINECAP BUTT PATTERN 5.0 5.0 END ENDNew in version 6.0: moved from SYMBOL
SIZE [double|attribute]
Height, in layer SIZEUNITS, of the symbol/pattern to be used. Only useful with scalable symbols (SYMBOL TYPE ellipse, hatch, pixmap, truetype, vector). Default is 1.0.
When scaling of symbols is in effect (SYMBOLSCALEDENOM is specified for the LAYER), SIZE gives the height, in layer SIZEUNITS, of the symbol/pattern to be used at the map scale 1:SYMBOLSCALEDENOM.
For symbols of TYPE hatch, the SIZE is the center to center distance between the lines. For its use with hatched lines, see Example#8 in the symbology examples.
[attribute] was introduced in version 5.0, to specify the attribute to use for size values. The hard brackets [] are required. For example, if your data set has an attribute named “MYHIGHT” that holds size values for each feature, your STYLE object for hatched lines might contain:
STYLE SYMBOL 'hatch-test' COLOR 255 0 0 ANGLE 45 SIZE [MYHIGHT] WIDTH 3.0 ENDThe associated RFC document for this feature is MS RFC 19: Style & Label attribute binding.
Starting from version 5.4, the value can also be a decimal value (and not only integer).
SIZE [attribute] must now be used instead.
Deprecated since version 5.0.
The symbol name or number to use for all features if attribute tables are not used. The number is the index of the symbol in the symbol file, starting at 1, the 5th symbol in the file is therefore symbol number 5. You can also give your symbols names using the NAME keyword in the symbol definition file, and use those to refer to them. Default is 0, which results in a single pixel, single width line, or solid polygon fill, depending on layer type.
You can also specify a GIF or PNG filename. The path is relative to the location of the mapfile.
[attribute] was introduced in version 5.6, to use an attribute to specify the symbol name. The hard brackets [] are required.
WIDTH [double|attribute]
WIDTH refers to the thickness of line work drawn, in layer SIZEUNITS. Default is 1.0.
When scaling of symbols is in effect (SYMBOLSCALEDENOM is specified for the LAYER), WIDTH refers to the thickness of the line work in layer SIZEUNITS at the map scale 1:SYMBOLSCALEDENOM.
- If used with SYMBOL and OUTLINECOLOR, WIDTH specifies the width of the symbol outlines. This applies to SYMBOL TYPE vector (polygons), ellipse and truetype.
- For lines, WIDTH specifies the width of the line.
- For polygons, if used with OUTLINECOLOR, WIDTH specifies the thickness of the polygon outline.
- For a symbol of SYMBOL TYPE hatch, WIDTH specifies the thickness of the hatched lines. For its use with hatched lines, see Example #7 in the symbology examples.
- [attribute] was added in version 5.2 to specify the attribute to use for the width value. The hard brackets [] are required.
- Starting from version 5.4, the value can also be a decimal value (and not only integer).