1

Can somebody help me with this error, it throws it when rendering an object and styling it with use of a buffer (sld style, wkt string). So I suppose that some problem is with buffering but was unable to figure out what is happening to solve it. Buffer values are mostly between -5 and -0.3. Example from sld file is bellow. Is it posible to this happens because of small values of the "Nagib"?

SEVERE  null
java.lang.NegativeArraySizeException
    at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75)
    at java.awt.image.Raster.createPackedRaster(Raster.java:467)
    at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
    at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
    at org.geotools.renderer.style.SLDStyleFactory.markToTilableImage(SLDStyleFactory.java:1229)
    at org.geotools.renderer.style.SLDStyleFactory.getTexturePaint(SLDStyleFactory.java:1171)
    at org.geotools.renderer.style.SLDStyleFactory.getPaint(SLDStyleFactory.java:1093)
    at org.geotools.renderer.style.SLDStyleFactory.setPolygonStyleFill(SLDStyleFactory.java:481)
    at org.geotools.renderer.style.SLDStyleFactory.createPolygonStyle(SLDStyleFactory.java:436)
    at org.geotools.renderer.style.SLDStyleFactory.createStyleInternal(SLDStyleFactory.java:375)
    at org.geotools.renderer.style.SLDStyleFactory.createStyle(SLDStyleFactory.java:328)
    at org.geotools.renderer.style.SLDStyleFactory.createStyle(SLDStyleFactory.java:291)
    at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:2569)
    at org.geotools.renderer.lite.StreamingRenderer.processFeature(StreamingRenderer.java:2453)
    at org.geotools.renderer.lite.StreamingRenderer.drawPlain(StreamingRenderer.java:2309)
    at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1930)
    at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:834)
    at org.geotools.swing.RenderingTask.call(RenderingTask.java:106)
    at org.geotools.swing.RenderingTask.call(RenderingTask.java:41)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

Example from sld

<Rule>
    <Name>Public building</Name>
    <Title>g</Title>
    <ogc:Filter> 
        <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>THEME_ID</ogc:PropertyName>
            <ogc:Literal>729</ogc:Literal> 
        </ogc:PropertyIsEqualTo> 
    </ogc:Filter> 
    <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>wkt://LINESTRING(0 0, ${sin(Nagib - 45) * 20000} ${cos(Nagib - 45) * 20000} )</WellKnownName>
                        <Stroke>
                            <CssParameter name="stroke">
                                <ogc:PropertyName>COLOR</ogc:PropertyName>
                            </CssParameter>
                            <CssParameter name="stroke-width">2.5</CssParameter>
                        </Stroke>
                    </Mark>
                </Graphic>
            </GraphicFill>
        </Fill>
    </PolygonSymbolizer> 
    <LineSymbolizer>
        <Stroke>
            <CssParameter name="stroke">
                <ogc:PropertyName>COLOR</ogc:PropertyName>
            </CssParameter>
            <CssParameter name="stroke-width">1</CssParameter>
        </Stroke>
    </LineSymbolizer>
</Rule>
2

This is actually caused by one of your symbols becoming very long (5.464099919557841E8px) which causes the renderer to overflow an integer and incorrectly think it is negative. I've raised a bug to improve the error message but it isn't actually a bug as there is no way for the renderer to draw this symbol.

If all you actually want is a rotated hatch I think you could just use a rotation element, something like:

<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>
</PolygonSymbolizer> 

Update

I've fixed the bug now you will get no image drawn instead of the exception.

  • I edited the question with the 'problem' I get when using rotated horline. Maybe it is better to post that as a new question, to keep it easier to track, but I am not sure. – Zoran Kokeza Nov 19 '17 at 17:01
  • that is probably a new question – Ian Turton Nov 20 '17 at 11:32

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.