5

When I use rotated horline or vertline like @Ian Turton suggested in his answer to question Rendering sld style(buffer) SEVERE null java.lang.NegativeArraySizeException, then I get breaks in the hatch, like on the image below. I can't find a way to get hatch without break. This hatch is rotated to the basis of an object by 45 degrees (so I can't use shape://slash), with different angles it looks even worse.

break in hatch

SLD suggested by @Ian

<PolygonSymbolizer>
<Geometry>
    <ogc:Function name="buffer">
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <ogc:PropertyName>Buffer</ogc:PropertyName>
    </ogc:Function>
</Geometry>  
<Fill>
    <GraphicFill>
        <Graphic>
            <Mark>
                <WellKnownName>shape://horline</WellKnownName>
                <Stroke>
                    <CssParameter name="stroke">
                        <ogc:PropertyName>COLOR</ogc:PropertyName>
                    </CssParameter>
                    <CssParameter name="stroke-width">2.5</CssParameter>
                </Stroke>
            </Mark>
            <Rotation>Nagib</Rotation>
        </Graphic>
    </GraphicFill>
</Fill>

4
+50

The solution is to use something similar to something you already used in the past (for reference Using Math in SLD file - wkt),

<PolygonSymbolizer>
    <Fill>
        <GraphicFill>
            <Graphic>
                <Mark>
                    <WellKnownName>wkt://LINESTRING(${cos(Nagib)*-20} ${sin(Nagib)*-20}, ${cos(Nagib)*20} ${sin(Nagib)*20} )</WellKnownName>
                    <Stroke>
                        <CssParameter name="stroke-width">1</CssParameter>
                    </Stroke>
                </Mark>
            </Graphic>
        </GraphicFill>
    </Fill>   
</PolygonSymbolizer>

angle 32 angle 14

For future users angles need to be specified in radians.

1

For the staircase look, when you render the layer, make sure to have anti-alliasing enabled.

For the "dotted line" look, you could get closer to a continuous line by using a wkt://MULTILINESTRING graphic fill. You would create one by setting the default angle, that you can further rotate. To achieve the continuous look, you would expand the line beyond coordinate 1 (any direction). Depending on the rotation you have to apply, you may want to to add rules and change the initial line coordinates.

Let's not forget that the symbol is repeated every 1 unit (grid of symbol) and the rotation applies to each symbol, so while you could manage to connect the lines between 2 adjacent symbol, the spacing between two lines will be affected and not constant.

Here is the relevant part of the SLD for the following screenshot. The initial symbol is angled at 45 degrees, on which I have applied a 10 degrees rotation

 <GraphicFill>
        <Graphic>
            <Mark>
                <WellKnownName>wkt://MULTILINESTRING((-1.5 -1.5,1.5 1.5))</WellKnownName>
                <Stroke>
                    <CssParameter name="stroke-width">1</CssParameter>
                </Stroke>
            </Mark>
            <Rotation>10</Rotation>
        </Graphic>
    </GraphicFill>

enter image description here

If you have no extra rotation (0), here is the default output (45 deg)

enter image description here

  • It only changes the quality of displayed graphics, doesn't fix the hatch problem. – Zoran Kokeza Nov 23 '17 at 22:10
  • @Zole95 ok, here is an edit for the other interpretation of the issue – JGH Nov 24 '17 at 12:44
  • Problem is bunch of possible rotations in one file, this is your style with rotation of 32 image.prntscr.com/image/-Y245ho7Rr6HvMPoIZu1rw.png – Zoran Kokeza Nov 24 '17 at 20:34

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.