[EMAIL PROTECTED] a écrit :
> Unfortunately I get an OutOfMemory: Java Heap Space exception,
> althought my test grid is not really a large one (somewhat 2800 x
> 2500 pixels). If I give Java more memory, the error does not disappear.
>
> Now my question: Is there I better solution to access and work with
> the grid values - maybe directly from the GridCoverage2D - to avoid
> the data transfer to an array? Or what else can I do?
You can uses the following methods:
double[] values = null;
values = GridCoverage2D.evaluate(position, values);
where "position" is a DirectPosition in the coverage CRS (not pixel
row/column).
GridCoverage2D will transforms the geographic coordinates to pixel coordinates
for you and returns the result for all bands in the given array (creating a new
one if necessary). You can use other primitive types like int[] for the array.
If you want to access pixel directly, you may consider JAI iterators which are
quite convenient and efficient:
http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/iterator/package-summary.html
Use RectIter if you want to access pixels sequentially, or the slightly slower
RandomIter if you want to access pixels at random positions.
Martin
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users