3.10.6. PolygonPatternSymbolizer

Table 29. PolygonPatternSymbolizer Attributes
Attribute Value Default Description

file

file path

none

base

string

none

name of a <FileSource> to find the input file in

alignment

gobal/local

global

Align image to polygon (local) or to map borders (global)

gamma

float

1.0

gamma-method

opacity

float

1.0

Filling opacity. May be somewhat transparent even at 1.0 if the fill pattern itself is not fully opaque.

clip

simplify

simplify-algorithm

smooth

float

0.0

transform

SVG Transform

none

Transformation is applied to the fill pattern

geometry-transform

SVG Transform

none

Transformation is applied to the polygon geometry itself

comp-op

SVG compositingg

none

Example 43. PolygonPatternSymbolizer file
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
  <FileSource name="symbols">./symbols/</FileSource>

  <Style name="style">
    <Rule>
      <PolygonPatternSymbolizer base="symbols" file="[file]"/>
      <TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="50">[file]</TextSymbolizer>
    </Rule>
  </Style>

  <Layer name="layer">
    <StyleName>style</StyleName>
    <Datasource>
      <Parameter name="type">csv</Parameter>
      <Parameter name="inline">
wkt,file
"POLYGON(( 2 1, 1 3, 3 4, 5 3, 4 1, 2 1))",dot.svg
"POLYGON((12 1,11 3,13 4,15 3,14 1,12 1))",steps.svg
"POLYGON((22 1,21 3,23 4,25 3,24 1,22 1))",bug.svg
      </Parameter>
    </Datasource>
  </Layer>

</Map>
file
Example 44. PolygonPatternSymbolizer alignment

global alignment makes the fill pattern align across touching polygon borders, local alignment makes each filled polygon of the same shape look exactly the same.

<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
  <FileSource name="symbols">./symbols/</FileSource>

  <Style name="style">
    <Rule>
       <PolygonPatternSymbolizer base="symbols" file="checker-board.svg" alignment="[align]"/>
       <LineSymbolizer stroke="black"/>
      <TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="false" dx="30" dy="30">[align]</TextSymbolizer>
    </Rule>
  </Style>

  <Layer name="layer">
    <StyleName>style</StyleName>
    <Datasource>
      <Parameter name="type">csv</Parameter>
      <Parameter name="inline">
wkt,align
"POLYGON(( 0 2, 1 3, 3 1, 2 0, 0 2))",global
"POLYGON(( 1 3, 2 4, 4 2, 3 1, 1 3))",global
"POLYGON(( 2 4, 3 5, 5 3, 4 2, 2 4))",global
"POLYGON((10 2,11 3,13 1,12 0,10 2))",local
"POLYGON((11 3,12 4,14 2,13 1,11 3))",local
"POLYGON((12 4,13 5,15 3,14 2,12 4))",local
      </Parameter>
    </Datasource>
  </Layer>

</Map>
alignment
Example 45. PolygonPatternSymbolizer transform
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
  <FileSource name="symbols">./symbols/</FileSource>

  <Style name="style">
    <Rule>
      <PolygonPatternSymbolizer base="symbols" file="steps.svg" transform="rotate([rotate])"/>
      <TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="50">[rotate]</TextSymbolizer>
    </Rule>
  </Style>

  <Layer name="layer">
    <StyleName>style</StyleName>
    <Datasource>
      <Parameter name="type">csv</Parameter>
      <Parameter name="inline">
wkt,rotate
"POLYGON(( 2 1, 1 3, 3 4, 5 3, 4 1, 2 1))",0
"POLYGON((12 1,11 3,13 4,15 3,14 1,12 1))",45
"POLYGON((22 1,21 3,23 4,25 3,24 1,22 1))",90
      </Parameter>
    </Datasource>
  </Layer>

</Map>
transform
Example 46. PolygonPatternSymbolizer geometry transform

Unlike wiht PointSymbolizer rotate() does not seem to rotate around the geometry center, but around the map origin at (0 0) instead?

<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
  <FileSource name="symbols">./symbols/</FileSource>

  <Style name="style">
    <Rule>
      <PolygonPatternSymbolizer base="symbols" file="steps.svg" geometry-transform="rotate([rotate])"/>
      <TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="50">[rotate]</TextSymbolizer>
    </Rule>
  </Style>

  <Layer name="layer">
    <StyleName>style</StyleName>
    <Datasource>
      <Parameter name="type">csv</Parameter>
      <Parameter name="inline">
wkt,rotate
"POLYGON(( 2 1, 1 3, 3 4, 5 3, 4 1, 2 1))",0
"POLYGON((12 1,11 3,13 4,15 3,14 1,12 1))",5
"POLYGON((22 1,21 3,23 4,25 3,24 1,22 1))",10
      </Parameter>
    </Datasource>
  </Layer>

</Map>
geometry transform

TODO: gamma, gamma-method, clip, simplify, simplify-method, comp-op