I need to symbolize a polygon layer with geoserver using an SVG file as an external graphic. The polygon should be filled with diagonal line. I have created the SVG in Inkscape using a 400px x 400px SVG Graphic. Geoserver renders the polyons as expected, but the SVG pattern has a gap between them. How can I remove this unsightly gap? This Problem does not occur when served with DEEGREE, so I am assuming it is a geoserver bug.

Link to Layer Hier

enter image description here

Here is the SVG:

<?xml version="1.0" encoding="utf-8" ?>

<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg">;

<polygon points="0 0  50 0 0 50" stroke="#FF0000" stroke-width="1px" 
fill="#FF0000" />

<polygon points="150 0 250 0 0 250 0 150" stroke="#FF0000" stroke-
width="1px" fill="#FF0000" />

<polygon points="0 400 0 350 350 0 400 0 400 50 50 400" stroke="#FF0000" 
stroke-width="1px" fill="#FF0000" />

<polygon points="400 150 400 250 250 400 150 400" stroke="#FF0000" stroke-
width="1px" fill="#FF0000" />

<polygon points="400 350 400 400 350 400" stroke="#FF0000" stroke-
width="1px" fill="#FF0000" />


Here is the SLD Symbolizer.

                                    xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:type="simple" xlink:href="ROK_gewerbe.svg"/>
                        <sld:CssParameter name="stroke">#666666</sld:CssParameter>
                        <sld:CssParameter name="stroke-width">1</sld:CssParameter>
                        <sld:CssParameter name="stroke-opacity">1</sld:CssParameter>
  • 1
    Please share the SVG. Also, I assume the question is "generic", there are better ways to create a hatch fill in GeoServer. – Andrea Aime Mar 6 '18 at 15:51
  • Above is the SVG. Using <WellKnownName>shape://backslash</WellKnownName> I am able to get a continuous line, but unfortunately due to the way the client works, it is required that the symbology uses SVGs. – Robert Buckley Mar 6 '18 at 16:04
  • You said it's 10px, but the ordinates in the SVG and its translation suggest otherwise. Maybe just try to remove the transforms, they are at least weird. – Andrea Aime Mar 6 '18 at 19:17
  • I have updated the SVG and the question to contain the newest svg file. Is anyone able to reproduce this error? – Robert Buckley Mar 6 '18 at 20:58
  • I assume is it a geoserver bug because DEEGREE renders this as a continuous line. – Robert Buckley Mar 7 '18 at 7:35

The solution to this problem was to append the following vendor option which removes any margins between SVGs

<se:VendorOption name="graphic-margin">-1</se:VendorOption>

enter image description here

Here the link to a working demo.


|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.