3.10.2. MarkersSymbolizer
The MarkersSymbolizer is similar to the PointSymbolizer, but has two advantages when used on a line or polygon: it can be drawn multiple times along a line automatically, and it’s orientation is rotated according to the current direction of the line instead of always being upright.
Attribute | Type | Default | Description |
---|---|---|---|
file path |
none |
||
|
string |
none |
name of a <FileSource> to find the input file in |
float |
1.0 |
Marker opacity for both fill and stroke |
|
float |
1.0 |
Marker fill opacity |
|
float |
1.0 |
Marker stroke opacity (only for internal markers) |
|
float |
0.5 |
Marker stroke width (only for internal markers) |
|
|
string |
none |
One of builtin types "ellipse" or "arrow", deprecated, use |
string |
each |
Where to put marker on multi part polygons: each, whole, largest |
|
float |
10 |
Marker symbol width in pixels |
|
float |
10 |
Marker symbol height in pixels |
|
string |
point |
Marker placement strategy: one of point, line, interior, vertex-first, vertex-last |
Known Problems
TODO: incomplete
Warning
|
The internal marker URIs like https://github.com/mapnik/mapnik/issues/4183[(Mapnik issue #4183) |
See also:
MarkersSymbolizer Examples
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<FileSource name="symbols">./symbols</FileSource>
<Style name="style">
<Rule>
<MarkersSymbolizer allow-overlap="true" base="symbols" file="[file]"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="20">[file]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,file
"POINT(0 0)",""
"POINT(1 0)","dot.svg"
"POINT(2 0)","bug.svg"
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<FileSource name="symbols">./symbols</FileSource>
<Style name="style">
<Rule>
<MarkersSymbolizer base="symbols" file="dot.svg" opacity="[opacity]"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="20">[opacity]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
opacity,wkt
0.0,"POINT( 0 0)"
0.1,"POINT( 1 0)"
0.2,"POINT( 2 0)"
0.3,"POINT( 3 0)"
0.4,"POINT( 4 0)"
0.5,"POINT( 5 0)"
0.6,"POINT( 6 0)"
0.7,"POINT( 7 0)"
0.8,"POINT( 8 0)"
0.9,"POINT( 9 0)"
1.0,"POINT(10 0)"
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<Style name="style">
<Rule>
<MarkersSymbolizer file="shape://ellipse" fill-opacity="0" stroke-width="1" stroke="red" stroke-opacity="[opacity]"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="20">[opacity]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
opacity,wkt
0.0,"POINT( 0 0)"
0.1,"POINT( 1 0)"
0.2,"POINT( 2 0)"
0.3,"POINT( 3 0)"
0.4,"POINT( 4 0)"
0.5,"POINT( 5 0)"
0.6,"POINT( 6 0)"
0.7,"POINT( 7 0)"
0.8,"POINT( 8 0)"
0.9,"POINT( 9 0)"
1.0,"POINT(10 0)"
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<FileSource name="symbols">./symbols</FileSource>
<Style name="style">
<Rule>
<MarkersSymbolizer base="symbols" file="dot.svg" opacity="[opacity]"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="20">[opacity]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
opacity,wkt
0.0,"POINT( 0 0)"
0.1,"POINT( 1 0)"
0.2,"POINT( 2 0)"
0.3,"POINT( 3 0)"
0.4,"POINT( 4 0)"
0.5,"POINT( 5 0)"
0.6,"POINT( 6 0)"
0.7,"POINT( 7 0)"
0.8,"POINT( 8 0)"
0.9,"POINT( 9 0)"
1.0,"POINT(10 0)"
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<Style name="style">
<Rule>
<MarkersSymbolizer file="shape://arrow" fill="blue" stroke-width="1" stroke="red" fill-opacity="[opacity]"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="20">[opacity]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
opacity,wkt
0.0,"POINT( 0 0)"
0.1,"POINT( 1 0)"
0.2,"POINT( 2 0)"
0.3,"POINT( 3 0)"
0.4,"POINT( 4 0)"
0.5,"POINT( 5 0)"
0.6,"POINT( 6 0)"
0.7,"POINT( 7 0)"
0.8,"POINT( 8 0)"
0.9,"POINT( 9 0)"
1.0,"POINT(10 0)"
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<FileSource name="symbols">./symbols</FileSource>
<Style name="style">
<Rule>
<LineSymbolizer stroke="black"/>
<MarkersSymbolizer allow-overlap="true" base="symbols" file="bug.svg" placement="[placement]" width="10" height="10" fill="red"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="50">[placement]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,placement
"POLYGON(( 1 1, 6 1, 6 5, 5 5, 5 2, 2 2, 2 5, 1 5, 1 1))",point
"POLYGON((11 1, 16 1, 16 5, 15 5, 15 2, 12 2, 12 5, 11 5, 11 1))",interior
"POLYGON((21 1, 26 1, 26 5, 25 5, 25 2, 22 2, 22 5, 21 5, 21 1))",line
"LINESTRING(31 1, 36 1, 36 5, 35 5, 35 2, 32 2, 32 5)",vertex-first
"LINESTRING(41 1, 46 1, 46 5, 45 5, 45 2, 42 2, 42 5)",vertex-last
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<FileSource name="symbols">./symbols</FileSource>
<Style name="style">
<Rule>
<MarkersSymbolizer allow-overlap="true" base="symbols" file="bug.svg" width="[width]" height="[height]"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="20">[width]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="30">[height]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,width,height
"POINT(0 0)",32,32
"POINT(1 0)",16,32
"POINT(2 0)",32,16
</Parameter>
</Datasource>
</Layer>
</Map>
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white">
<Style name="style">
<Rule>
<PolygonSymbolizer fill="lightgray"/>
<LineSymbolizer stroke="black"/>
<MarkersSymbolizer allow-overlap="true" file="shape://ellipse" multi-policy="[placement]" width="10" height="10" fill="red"/>
</Rule>
</Style>
<Layer name="layer">
<StyleName>style</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,placement
"MULTIPOLYGON((( 30 20, 60 20, 60 70, 30 70, 30 20)),(( 90 10, 110 10, 110 30, 90 30, 90 10)),(( 90 50, 120 50, 120 80, 90 80, 90 50)))",each
"MULTIPOLYGON(((130 20,160 20,160 70,130 70,130 20)),((190 10, 210 10, 210 30,190 30,190 10)),((190 50, 220 50, 220 80,190 80,190 50)))",whole
"MULTIPOLYGON(((230 20,260 20,260 70,230 70,230 20)),((290 10, 310 10, 310 30,290 30,290 10)),((290 50, 320 50, 320 80,290 80,290 50)))",largest
</Parameter>
</Datasource>
</Layer>
<Style name="style2">
<Rule>
<LineSymbolizer stroke="blue" stroke-width="2"/>
<TextSymbolizer face-name="DejaVu Sans Book" allow-overlap="true" dy="60">[placement]</TextSymbolizer>
</Rule>
</Style>
<Layer name="layer2">
<StyleName>style2</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
wkt,placement
"POLYGON(( 27 5, 123 5, 123 85, 27 85, 27 15))",each
"POLYGON((127 5, 223 5, 223 85, 127 85, 127 15))",whole
"POLYGON((227 5, 323 5, 323 85, 227 85, 227 15))",largest
</Parameter>
</Datasource>
</Layer>
</Map>