|
From: Michael B. <mic...@gm...> - 2009-12-06 08:45:40
|
Hi Jan, It looks like a mix up between your data array size and your image size. BufferedImages only have a single image tile so when you create your sample model like this... > SampleModel model = new > BandedSampleModel(DataBuffer.TYPE_INT, 100, 100, 1); And use that to create your image... > BufferedImage img = new BufferedImage(colorModel, raster, false, null); You are making a 100 x 100 image. The problem is that you used your data array size to create the data buffer and raster... Then you use your 1000 x 1000 data matrix to create a data buffer and raster > DataBuffer buffer = new DataBufferInt(data, data.length); > WritableRaster raster = Raster.createWritableRaster(model, buffer, null); So when you try to use the image by writing our the coverage to a GeoTiff, you get the array out of bounds message. To fix the problem you can either make your sample model 1000 x 1000 or use a different kind of image that supports multiple image tiles. The former is easier, the latter can make your app less of a memory hog depending on how you use the data. Hope this helps - get back to us if you need more info. Michael |