[GIS] SLD polygon graphic fill – hatch

geoservergeotoolssld

I am trying to create an SLD to style a polygon; the goal is to create hash fill for polygon but to leave empty space between hatch and bounds of the polygon, something like this:
goal

I am using this to create fill

<PolygonSymbolizer>
    <Fill>
        <GraphicFill>
            <Graphic>
                <Mark>
                    <WellKnownName>shape://slash</WellKnownName>
                    <Stroke>
                        <CssParameter name="stroke">#000000</CssParameter>
                        <CssParameter name="stroke-width">1</CssParameter>
                    </Stroke>
                </Mark>
            </Graphic>
        </GraphicFill>
    </Fill>
</PolygonSymbolizer> 
<LineSymbolizer>
    <Stroke>
        <CssParameter name="stroke">#000000</CssParameter>
        <CssParameter name="stroke-width">1</CssParameter>
    </Stroke>
</LineSymbolizer>

There is a way to use a thicker white line, but if there is some object near I wont be able to see it, so that is not an option.

Best Answer

So the option you do not like would be to add this:

<LineSymbolizer>
    <Stroke>
        <CssParameter name="stroke">#FFFFFF</CssParameter>
        <CssParameter name="stroke-width">8</CssParameter>
    </Stroke>
    <PerpendicularOffset>-4</PerpendicularOffset>
</LineSymbolizer>  

I've tested and it works but as you say it may block other objects. What you could try is something like this which aims to interior buffer the polygon, however you may find the computation overheads make it unfeasible:

<PolygonSymbolizer>
     <Geometry>
       <ogc:Function name="buffer">
          <ogc:PropertyName>the_geom</ogc:PropertyName>
          <ogc:Literal>-.1</ogc:Literal>
       </ogc:Function>
     </Geometry>  
    <Fill>
        <GraphicFill>
            <Graphic>
                <Mark>
                    <WellKnownName>shape://slash</WellKnownName>
                    <Stroke>
                        <CssParameter name="stroke">#000000</CssParameter>
                        <CssParameter name="stroke-width">1</CssParameter>
                    </Stroke>
                </Mark>
            </Graphic>
        </GraphicFill>
    </Fill>
</PolygonSymbolizer> 

Note I have not tested this successfully. Alternatively is it possible for you to pre-compute the interior buffers and just display both, one hatched with no boundary and one no fill but with a boundary?