Dear all,
I'm developing a quite simple tool for the generation of custom format
pyramids starting from (usually) geotiff data. I would like to
maximize the performances given the big dimension of input files and
consequent computational time.
I'm using GT14.0 and EXTJAI, working on a win 7 x64 machine in Eclipse
using maven.
My approach is:
1)read the source file and allocate the main GridCoverage2D obejct:
...
reader = new GeoTiffReader(url);
ticToc.tic("Start reading dataset");
inputCoverage = reader.read(null);
....
2)generate a queue of threads accessing the inputCoverage and working
on it in the following way:
-perform a Crop operation:
ParameterValueGroup params =
processor.getOperation("CoverageCrop").getParameters();
params.parameter("Source").setValue(coverage);
params.parameter("Envelope").setValue(destinationEnvelope);
croppedGridCoverage = (GridCoverage2D) processor.doOperation(params);
-perform a resample operation:
ParameterValueGroup params = processor.getOperation("Resample").getParameters();
params.parameter("Source").setValue(sourceCoverage);
params.parameter("GridGeometry").setValue(destgridGeometry);
params.parameter("InterpolationType").setValue("Bilinear");
subCoverage = processor.doOperation(params);
And finally extrapolate the content of the resulting GridCoverage2D in
order to write the resulting tiles in the custom format (a sort of
esri .bil .hdr).
Here is the point where I'm not able to reach good performances. I
tested 2 different solution with similar results:
image = subCoverage.getRenderedImage();
if (image != null) {
buffer = new short[sizeH * sizeW];
image.getData().getSamples(boarderPadding, boarderPadding, sizeW,
sizeH, 0, tmpBuffer);
}
and
image = subCoverage.getRenderedImage();
if (image != null) {
int i = 0;
RandomIter readIter = RandomIterFactory.create(image, null, false,
false);
for (int r = 0; r < sizeH; r++) {
for (int c = 0; c < sizeW; c++) {
tmpBuffer[i] = readIter.getSampleFloat(c, r, 0);
i++;
}
}
}
The first 2 operations (crop and rescale) takes always almost the same
time to execute (about 0.01 second or less) while the data
extrapolation operation (the last one) take from 0.1 to 5 seconds
albeit the source renderedimage has always the same dimension (65*65
pixel).
I'm not really an expert of geotools: any suggestion providing a
performance improvement will be really useful but I'm looking mainly
for an optimized way to extrapolate the data.
I noticed that GridCoverage2D.show() method on the same final coverage
I have is really fast (and I believe that in order to draw the image
the pixel value must be read) : how can I get the same performances
for my purpose?
Thank you in advance for your help,
best regards Marco
------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users