[...]
>> GridCoverage2D coverage2D = factory.create(name, writableRaster,
>> writeEnvelope, new GridSampleDimension[]{band});
>
> A possible approach is to keep around the WritableRaster that you gave to this
> constructor. Because GridCoverage2D will wrap it (not copy it), any changes
> you
> make in this raster will be immediately visible to the GridCoverage2D.
>
> If you want to get back the WritableRaster after the GridCoverage2D has been
> created, then you approach is almost what you need:
>
>> coverage2D.getRenderedImage().getData();
>
> Lets just modify that a bit (because getData() copy the whole raster, which is
> probably not what you want):
>
> RenderedImage image = coverage2D.getRenderedImage();
>
> // Following cast you work if the original image was writable.
> WritableRenderedImage wri = (WritableRenderedImage) image;
>
> // To be very strict, we should looks at how many tiles
> // are in that image. In the case where we know that the
> // original image was a BufferedImage and because I'm lazy,
> // lets assume that is only one big tile:
> WritableRaster raster = wri.getWritableTile(0,0);
>
> // do you computation here, and when you are done:
> wri.releaseWritableTile(0,0);
That all solves every doubt I had and is exactly what I was looking for.
But now I have a new doubt, which also gives me hope :)
It is regarding tiles. Why would it make sense to use tiles when using
a writable raster?
I mean, it was created in memory and therefore taking just tiles is
the same as taking it all?
Or is there a way to already predefine a disk space on which the
writableraster in case would be dumped to?
Not sure if it is clear, I hope so. :)
Andrea
>
>
> Martin
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users