new NullProgressListener() // progressListener
);
// Final checks on the result
Assert.assertNotNull(rasterZip);
GeoTiffReader reader = null;
GridCoverage2D gc = null, gcResampled = null;
try {
final File[] tiffFiles = extractTIFFFile(rasterZip);
Assert.assertNotNull(tiffFiles);
Assert.assertTrue(tiffFiles.length > 0);
reader = new GeoTiffReader(tiffFiles[0]);
gc = reader.read(null);
Assert.assertNotNull(gc);
Assert.assertEquals(-130.88669845369998,
gc.getEnvelope().getLowerCorner().getOrdinate(0), 1E-6);
Assert.assertEquals(48.611129008700004, gc.getEnvelope().getLowerCorner()
.getOrdinate(1), 1E-6);
Assert.assertEquals(-123.95304462109999,
gc.getEnvelope().getUpperCorner().getOrdinate(0), 1E-6);
Assert.assertEquals(54.0861661371, gc.getEnvelope().getUpperCorner().getOrdinate(1),
1E-6);
} finally {
if (gc != null) {
CoverageCleanerCallback.disposeCoverage(gc);
}
if (reader != null) {
reader.dispose();
}
// clean up process
resourceManager.finished(resourceManager.getExecutionId(true));
}
// Download the coverage as tiff (Reprojected)
File resampledZip = downloadProcess.execute(getLayerId(MockData.USA_WORLDIMG), // layerName
null, // filter
"image/tiff", // outputFormat
CRS.decode("EPSG:900913", true), // targetCRS
CRS.decode("EPSG:900913", true), // roiCRS
roiResampled, // roi
true, // cropToGeometry
new NullProgressListener() // progressListener
);
// Final checks on the result
Assert.assertNotNull(resampledZip);
try {
File[] files = extractTIFFFile(resampledZip);
reader = new GeoTiffReader(files[files.length - 1]);
gcResampled = reader.read(null);
Assert.assertNotNull(gcResampled);
Assert.assertEquals(-1.457024062347863E7, gcResampled.getEnvelope().getLowerCorner()
.getOrdinate(0), 1E-6);
Assert.assertEquals(6209706.404894806, gcResampled.getEnvelope().getLowerCorner()
.getOrdinate(1), 1E-6);
Assert.assertEquals(-1.379838980949677E7, gcResampled.getEnvelope().getUpperCorner()
.getOrdinate(0), 1E-6);
Assert.assertEquals(7187128.139081598, gcResampled.getEnvelope().getUpperCorner()
.getOrdinate(1), 1E-6);
} finally {
if (gcResampled != null) {
CoverageCleanerCallback.disposeCoverage(gcResampled);
}
if (reader != null)
reader.dispose();
// clean up process
resourceManager.finished(resourceManager.getExecutionId(true));
}
}