Wrong tiles returned out of a MetaTile if output format is JPEG
---------------------------------------------------------------
Key: GEOS-3612
URL: http://jira.codehaus.org/browse/GEOS-3612
Project: GeoServer
Issue Type: Bug
Components: WMS
Affects Versions: 2.0.0
Reporter: Gabriel Roldán
Assignee: Simone Giannecchini
Fix For: 2.0.1
Found this when using the embedded OL tiling client over an ArcSDE raster. Those are backed by a RenderedImage read from a RawImageInputStream.
Problem is the tiles returned by MetatileMapProduder are subsets of the metatile given by the image's minx/miny/width/height, but the JPEG map producer is alway returning the first tile leading to a sort of repeating pattern map.
The following patch works this around, though I aknowledge it requires a perhaps unwanted image copy, I can't find a better solution for what it seems to be a JAI bug.
{code}
Index: src/main/java/org/vfny/geoserver/wms/responses/map/jpeg/JPEGMapProducer.java
--- src/main/java/org/vfny/geoserver/wms/responses/map/jpeg/JPEGMapProducer.java (revision 13562)
+++ src/main/java/org/vfny/geoserver/wms/responses/map/jpeg/JPEGMapProducer.java (working copy)
@@ -16,6 +16,7 @@
import javax.imageio.ImageIO;
import javax.media.jai.InterpolationNearest;
+import javax.media.jai.PlanarImage;
import javax.media.jai.operator.TranslateDescriptor;
import org.apache.tools.ant.taskdefs.optional.i18n.Translate;
@@ -74,7 +75,16 @@
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("About to write a JPEG image.");
}
- if (! JPEGNativeAcc.booleanValue()&&image.getMinX()!=0 || image.getMinY()!=0) {
+ if (image instanceof PlanarImage && (image.getMinX() != 0 || image.getMinY() != 0)) {
+ /*
+ * GR: for the case of JPEG tiles coming from MetatileMapProducer I'm getting a copy of
+ * it because otherwise the ImageWorker writes out the first tile (at 0,0) instead of
+ * the one specified by the image minx and miny
+ */
+ image = ((PlanarImage) image).getAsBufferedImage();
+ }
+ final boolean jpegNativeAcc = JPEGNativeAcc.booleanValue();
+ if (! jpegNativeAcc&&image.getMinX()!=0 || image.getMinY()!=0) {
// I don't make an expliciti copy anymore, hoping that sooner or later:
// A> this bug will be fixed
// B> JDK JpegImageWriter will stop making a straight copy of the input raster
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira