Skip to content

Commit 5e9e18f

Browse files
author
AD\akopinga
committed
Add note about ExternalGraphics in README
1 parent 1fa2035 commit 5e9e18f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,46 @@ Wellknown names that reference a symbol library, like `ttf://CustomFont#42` are
5454

5555
Only one Graphic per PointSymbolizer is supported. Each Graphic can only have one Mark or one ExternalGraphic.
5656

57+
#### ExternalGraphic
58+
59+
External graphics can be used with an `OnlineResource` linking to a valid image url.
60+
61+
```xml
62+
<se:ExternalGraphic>
63+
<se:OnlineResource xlink:type="simple" xlink:href="assets/img/flag-nl.png"/>
64+
<se:Format>image/png</se:Format>
65+
</se:ExternalGraphic>
66+
```
67+
68+
External graphics can also be embedded as base64 string using `InlineContent` with `encoding="base64"`.
69+
70+
```xml
71+
<se:ExternalGraphic>
72+
<se:InlineContent encoding="base64">iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==</se:InlineContent>
73+
<se:Format>image/jpeg</se:Format>
74+
</se:ExternalGraphic>
75+
```
76+
77+
Inline content can also be SVG with `encoding="xml"`.
78+
79+
```xml
80+
<se:ExternalGraphic>
81+
<se:InlineContent encoding="xml">
82+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
83+
<path d="M50,3l12,36h38l-30,22l11,36l-31-21l-31,21l11-36l-30-22h38z" fill="#0F0" stroke="#040" stroke-width="2"/>
84+
</svg>
85+
</se:InlineContent>
86+
<se:Format>image/svg+xml</se:Format>
87+
</se:ExternalGraphic>
88+
```
89+
90+
**Important notes for inline SVG:**
91+
92+
- Do not include the `<?xml ... ?>` header in the inline content.
93+
- Make sure that the SVG has `width` and `height` attributes. Without it, (most?) browsers cannot properly load the SVG as an image.
94+
5795
#### QGIS parametric SVG support (experimental)
96+
5897
SLD's with parametric embedded SVG's exported by QGIS should be able to be used in SLDReader.
5998

6099
Support for this functionality is quite hacky and experimental, but appears to work for simple examples.

0 commit comments

Comments
 (0)