Hello,
As introduction, thanks for providing this awesome library. I have now
been using it now for over a year, mostly within geoserver.
I find this the email list the easiest way of providing you with a
proposed patch.
Lot of my data is raster data with alpha-channel. About 2% fail when
serving them through the tile server at some resolutions. I can't
produce a small, self-contained exampl, unfortunately. But I have
tracked it down and it seems the alpha-channel is rendered separately
from the rest of the image and is "allergic" to 0-size tile-width.
This is the way I fixed it in 21.1 (verified in my environment).
If necessary, I can give you the stack trace from the logs, some
AWT class doesn't like 0.
diff --git
a/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java
b/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java
index b8c20ab..4fb4e1e 100644
--- a/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java
+++ b/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java
@@ -4629,15 +4629,17 @@ public class ImageWorker {
Object candidate = hints.get(JAI.KEY_IMAGE_LAYOUT);
if (candidate instanceof ImageLayout) {
ImageLayout layout = (ImageLayout) candidate;
- ImageLayout layout2 =
- new ImageLayout2(
- layout.getTileGridXOffset(null),
- layout.getTileGridYOffset(null),
- layout.getTileWidth(null),
- layout.getTileHeight(null),
- sm,
- cm);
- merged.setRenderingHints(new
RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout2));
+ if (layout.getTileWidth(null) > 0 &&
layout.getTileHeight(null) > 0) {
+ ImageLayout layout2 =
+ new ImageLayout2(
+ layout.getTileGridXOffset(null),
+ layout.getTileGridYOffset(null),
+ layout.getTileWidth(null),
+ layout.getTileHeight(null),
+ sm,
+ cm);
+ merged.setRenderingHints(new
RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout2));
+ }
}
image = merged.addBand(alphaChannel, false, true,
null).getRenderedImage();
}
Sincerely,
Michael
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel