ReferencedEnvelope mapExtent = new ReferencedEnvelope(-20037508.34, 20037508.34,
-20037508.34, 20037508.34, googleMercator);
Rectangle screenSize = new Rectangle(200, (int) (mapExtent.getHeight()
/ mapExtent.getWidth() * 200));
AffineTransform w2s = RendererUtilities.worldToScreenTransform(mapExtent, screenSize);
GridCoverageRenderer renderer = new GridCoverageRenderer(googleMercator, mapExtent,
screenSize, w2s);
RasterSymbolizer rasterSymbolizer = new StyleBuilder().createRasterSymbolizer();
GridCoverage2D coverage = worldReader.read(null);
RenderedImage image = renderer.renderImage(coverage, rasterSymbolizer,
Interpolation.getInstance(Interpolation.INTERP_NEAREST), Color.RED, 256, 256);
File reference = new File(
"src/test/resources/org/geotools/renderer/lite/gridcoverage2d/googleMercator.png");
ImageAssert.assertEquals(reference, image, 0);
}