Monday, 26 September 2016

geotools - Rendering sld style(buffer) SEVERE null java.lang.NegativeArraySizeException


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.(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.(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



Public building
g



THEME_ID
729





the_geom
Buffer







wkt://LINESTRING(0 0, ${sin(Nagib - 45) * 20000} ${cos(Nagib - 45) * 20000} )


COLOR


2.5










COLOR

1




Answer



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:






the_geom
Buffer







shape://horline


COLOR

2.5


Nagib






Update


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


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...