tableName = "SDE.RASTER.IMG_COQ2001_CLIP_BOS_1";
final AbstractGridCoverage2DReader reader = getReader();
assertNotNull("Couldn't obtain a reader for " + tableName, reader);
final GeneralEnvelope originalEnvelope = reader.getOriginalEnvelope();
GridEnvelope originalGridRange = reader.getOriginalGridRange();
final int reqWidth = originalGridRange.getSpan(0) / 4;
final int reqHeight = originalGridRange.getSpan(1) / 4;
Envelope reqEnvelope = originalEnvelope;
// GeneralEnvelope reqEnvelope = new GeneralEnvelope(originalEnvelope
// .getCoordinateReferenceSystem());
//
// final double reqMinx = 235901.26048201;
// final double reqMiny = 901552.0880242661;
// final double reqMaxx = 236781.26048201;
// final double reqMaxy = 902253.0880242661;
//
// reqEnvelope.setEnvelope(reqMinx, reqMiny, reqMaxx, reqMaxy);
final GridCoverage2D coverage = readCoverage(reader, reqWidth, reqHeight, reqEnvelope);
assertNotNull("read coverage returned null", coverage);
GridGeometry2D gg = coverage.getGridGeometry();
Envelope2D envelope2D = gg.getEnvelope2D();
GridEnvelope gridRange = gg.getGridRange();
System.out.println("requested size: " + reqWidth + "x" + reqHeight);
System.out.println("result size : " + gridRange.getSpan(0) + "x" + gridRange.getSpan(1));
System.out.println("requested envelope: " + reqEnvelope);
System.out.println("result envelope : " + envelope2D);