[Geoserver-devel] Pyramid builder broken (again)

Hi,
today I was trying to fix use the pyramid builder to generate
a bluemarble pyramid out of a mosaic of geotiffs and... well,
I got for the third time the same error I encontered before,
just with a slight variation: tiles overlapping, this time
they are not exactly in the same place, but quite close.

See the gdalinfo output for three adiancent tiles (each tile
being more or less 2x2 degrees in size).

C:\progetti\gisData\bluemarble\mosaic\pyramid\0>gdalinfo mosaic_0.tiff
Driver: GTiff/GeoTIFF
Size is 514, 514
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.2572235630016,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433],
     AUTHORITY["EPSG","4326"]]
Origin = (-179.997915508615900,0.047943301835886)
Pixel Size = (0.004168982768204,-0.004168982768204)
Metadata:
   AREA_OR_POINT=Point
   TIFFTAG_XRESOLUTION=1
   TIFFTAG_YRESOLUTION=1
   TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Image Structure Metadata:
   COMPRESSION=JPEG
Corner Coordinates:
Upper Left (-179.9979155, 0.0479433) (179d59'52.50"W, 0d 2'52.60"N)
Lower Left (-179.9979155, -2.0949138) (179d59'52.50"W, 2d 5'41.69"S)
Upper Right (-177.8550584, 0.0479433) (177d51'18.21"W, 0d 2'52.60"N)
Lower Right (-177.8550584, -2.0949138) (177d51'18.21"W, 2d 5'41.69"S)
Center (-178.9264869, -1.0234853) (178d55'35.35"W, 1d 1'24.55"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha

C:\progetti\gisData\bluemarble\mosaic\pyramid\0>gdalinfo mosaic_1.tiff
Driver: GTiff/GeoTIFF
Size is 515, 514
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.2572235630016,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433],
     AUTHORITY["EPSG","4326"]]
Origin = (-179.993758668515940,0.047943301835886)
Pixel Size = (0.004160887656033,-0.004168982768204)
Metadata:
   AREA_OR_POINT=Point
   TIFFTAG_XRESOLUTION=1
   TIFFTAG_YRESOLUTION=1
   TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Image Structure Metadata:
   COMPRESSION=JPEG
Corner Coordinates:
Upper Left (-179.9937587, 0.0479433) (179d59'37.53"W, 0d 2'52.60"N)
Lower Left (-179.9937587, -2.0949138) (179d59'37.53"W, 2d 5'41.69"S)
Upper Right (-177.8509015, 0.0479433) (177d51'3.25"W, 0d 2'52.60"N)
Lower Right (-177.8509015, -2.0949138) (177d51'3.25"W, 2d 5'41.69"S)
Center (-178.9223301, -1.0234853) (178d55'20.39"W, 1d 1'24.55"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha

C:\progetti\gisData\bluemarble\mosaic\pyramid\0>gdalinfo mosaic_2.tiff
Driver: GTiff/GeoTIFF
Size is 514, 514
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.2572235630016,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433],
     AUTHORITY["EPSG","4326"]]
Origin = (-180.002084491384100,0.047943301835886)
Pixel Size = (0.004168982768204,-0.004168982768204)
Metadata:
   AREA_OR_POINT=Point
   TIFFTAG_XRESOLUTION=1
   TIFFTAG_YRESOLUTION=1
   TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Image Structure Metadata:
   COMPRESSION=JPEG
Corner Coordinates:
Upper Left (-180.0020845, 0.0479433) (180d 0'7.50"W, 0d 2'52.60"N)
Lower Left (-180.0020845, -2.0949138) (180d 0'7.50"W, 2d 5'41.69"S)
Upper Right (-177.8592273, 0.0479433) (177d51'33.22"W, 0d 2'52.60"N)
Lower Right (-177.8592273, -2.0949138) (177d51'33.22"W, 2d 5'41.69"S)
Center (-178.9306559, -1.0234853) (178d55'50.36"W, 1d 1'24.55"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha

Well, I guess the coverage tiler sorely needs some unit testing...
Oh, the tiles above are on Antarctica, so the latitude is wrong,
too.

Not too sure if the mosaic is ok, it has been generated by mosaic
builder, but I cannot look at it because I get the following exception
on preview:

210453 [AVVERTENZA] org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer - Dimensions (width=1898886 height=3275556) are too large
java.lang.IllegalArgumentException: Dimensions (width=1898886 height=3275556) are too large
  at java.awt.image.SampleModel.<init>(SampleModel.java:112)
  at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:128)
  at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:69)
  at java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:126)
  at javax.media.jai.PlanarImage.getExtendedData(PlanarImage.java:2451)
  at javax.media.jai.GeometricOpImage.computeTile(GeometricOpImage.java:678)
  at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
  at javax.media.jai.OpImage.getTile(OpImage.java:1129)
  at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
  at javax.media.jai.PlanarImage.getExtendedData(PlanarImage.java:2440)
  at javax.media.jai.ScaleOpImage.computeTile(ScaleOpImage.java:1255)
  at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
  at javax.media.jai.OpImage.getTile(OpImage.java:1129)
  at javax.media.jai.RenderedOp.getTile(RenderedOp.java:2257)
  at sun.java2d.SunGraphics2D.drawTranslatedRenderedImage(SunGraphics2D.java:2429)
  at sun.java2d.SunGraphics2D.drawRenderedImage(SunGraphics2D.java:2316)
  at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.paint(GridCoverageRenderer.java:788)
  at org.geotools.renderer.lite.StreamingRenderer.renderRaster(StreamingRenderer.java:1896)
  at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:1678)
  at org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1622)
  at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1564)
  at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:714)
  at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:436)
  at org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.produceMap(DefaultRasterMapProducer.java:250)
  at org.vfny.geoserver.wms.responses.GetMapResponse.execute(GetMapResponse.java:307)
  at org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:516)
  at org.vfny.geoserver.servlets.AbstractService.doGet(AbstractService.java:315)
  at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:192)
  at org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:52)
  at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
  at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:347)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:445)
  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1050)
  at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:103)
  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041)
  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:354)
  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:627)
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
  at org.mortbay.jetty.Server.handle(Server.java:269)

Cheers
Andrea