GeoTools

OSGeo

Table Of Contents

Previous topic

Chart Plugin

Next topic

Shapefile Renderer

This Page

SVG Plugin

The gt-svg plugin uses the Batik library to support the use of SVG graphics.

Maven:

<dependency>
  <groupId>org.geotools</groupId>
  <artifactId>gt-svg</artifactId>
  <version>${geotools.version}</version>
</dependency>

Example

The following example is taken from test cases:

Here is the example fillHouse.sld:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"
  xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>

    <Name>Grass</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <PolygonSymbolizer>
            <Fill>
              <GraphicFill>
                <Graphic>
                  <ExternalGraphic>
                    <OnlineResource xlink:type="simple" xlink:href="house.svg" />
                    <Format>image/svg</Format>
                  </ExternalGraphic>
                  <size>64</size>
                </Graphic>
              </GraphicFill>
            </Fill>
            <Stroke/>
          </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>