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

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to