Symbolizers
Graphic symbology can be used in different contexts through the
Graphic
tag. For instance, you can used it to display symbols at points, or
to fill polygons with textures.
Colors should be defined as RGB hexadecimals, preceded by a #. For example,
#FF000
corresponds to the red color.
Length and distances are interpreted in pixels.
Important:
|
You can use the following tags:
PointSymbolizer
PolygonSymbolizer
lets you define symbols at points using a
Graphic
tag.
This tag can contain a Mark
or ExternalGraphic
tag.
Mark
Mark
lets you set simple rendering attributes. Below is an
example:
<PointSymbolizer> <Graphic> <Mark> <Fill> <SvgParameter name="fill">#ff0000</SvgParameter> </Fill> </Mark> </Graphic> </PointSymbolizer>
- 'fill' represents a color and is used as the base color:
<CssParameter name="fill">#8C875B</CssParameter>
- 'fill-opacity' represents a ratio of opacity for the surface of the represented geometry:
<SvgParameter name="fill-opacity">0.7</SvgParameter>
For POI billboard layers, the color and opacity are applied over the default graphic or user-defined icon.
ExternalGraphic
ExternalGraphic
lets you define point billboard geometries. Each
associated point displays the described graphic icon. Below is an example:
<PointSymbolizer> <Graphic> <ExternalGraphic> <OnlineResource xlink:type="simple" xlink:href="sld_icons/LOCATION_01.png"/> <Format>image/png</Format> </ExternalGraphic> <AnchorPoint> <AnchorPointX>1.0</AnchorPointX> AnchorPointY>1.0</AnchorPointY> </AnchorPoint> <Displacement> <DisplacementX>0</DisplacementX> <DisplacementY>0</DisplacementY> </Displacement> </Graphic> </PointSymbolizer>
Relative urls access the dataset’s source document as a root. It can access zipped hierarchies as in the example abovewhere sld_icons is a zipped folder.
Anchor Point
Represents the point that anchors to the scene. The anchorX
and
anchor Y
parameters are a ratio of the graphic’s dimensions.
Displacement
Gives the possibility to offset in pixels the anchor point.
LineSymbolizer
LineSymbolizer
defines styling for lines.
Below is an example:
<LineSymbolizer> <Stroke> <CssParameter name="stroke">#0000FF</CssParameter> <CssParameter name="stroke-width">3</CssParameter> <CssParameter name="stroke-opacity">1</CssParameter> <CssParameter name="stroke-dasharray">4 0.2 1.4 2</CssParameter> </Stroke> </LineSymbolizer>
Stroke rendering parameters are used but note that Fill
rendering
parameters cannot be used to fill lines.
- 'stroke' represents a color and is used as the color of the stroke
- 'stroke-opacity' represents a ratio of opacity for the stroke of the associated geometry
- 'stroke-width' represents the width of the related stroke
- 'stroke-dasharray' is a list of float values representing a dashArray pattern.
PolygonSymbolizer
PolygonSymbolizer
defines styling for polygons.
A polygon layer can display a filled surface and/or a stroke geometry. Below is an example:
<PolygonSymbolizer> <Fill> <CssParameter name="fill">#8C875B</CssParameter> <CssParameter name="fill-opacity">0.8</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">#0000FF</CssParameter> <CssParameter name="stroke-width">44.35433</CssParameter> <CssParameter name="stroke-opacity">0.2</CssParameter> <CssParameter name="stroke-dasharray">4 0.2 1.4 2</CssParameter> </Stroke> </PolygonSymbolizer>
where:
- 'fill' represents a color and is used as the base color:
<CssParameter name="fill">#8C875B</CssParameter>
- 'fill-opacity' represents a ratio of opacity for the surface of the represented
geometry:
<SvgParameter name="fill-opacity">0.7</SvgParameter>
- 'stroke' represents a color and is used as the color of the stroke
- 'stroke-opacity' represents a ratio of opacity for the stroke of the associated geometry
- 'stroke-width' represents the width of the related stroke
- 'stroke-dasharray' is a list of float values representing a dashArray pattern.
The SvgParameter
and CssParameter
tags can be used to
define the interior (fill) and border (stroke) of polygons.
PolygonSymbolizer
can also contain a GraphicFill
tag to
use external graphics. Below is an
example:
<PolygonSymbolizer> <Fill> <GraphicFill> <Graphic> <ExternalGraphic> <OnlineResource xlink:type="simple" xlink:href="Points.png"/> <Format>image/png</Format> </ExternalGraphic> </Graphic> </GraphicFill> </Fill> </PolygonSymbolizer>
Text Symbolizer
TextSymbolizer
lets you define styling for text labels. Note that
labels are always displayed in overlay mode.
The CssParameter
tag can be used to define the font. Below is an
example:
<TextSymbolizer> <Label> <PropertyName>TEXTSTRING</PropertyName> </Label> <Font> <CssParameter name="font-family">arial</CssParameter> <CssParameter name="font-size">12</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Displacement> <DisplacementX>-30</DisplacementX> <DisplacementY>-30</DisplacementY> </Displacement> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#000000</CssParameter> </Fill> </TextSymbolizer>
The following tags can be used to define a TextSymbolizer
:
Label
It should contain a
PropertyName
referencing the label contents for each geometry.Fill
- 'fill' represents a color and is used as the base
color:
<CssParameter name="fill">#8C875B</CssParameter>
- 'fill-opacity' represents a ratio of opacity for the surface of the represented
geometry:
<SvgParameter name="fill-opacity">0.7</SvgParameter>
- 'fill' represents a color and is used as the base
color:
Font
The font parameters available for this tag are as follows:
- font-family
- font-style
- font-weight
- font-size
LabelPlacement
Defines the label position. The following parameters are avalable:
PointPlacement
Displacement
Rotation
AnchorPoint
is always the center of the label. The
Displacement
and Rotation
tags can be used.