I am trying (unsuccessfully) to add raster reprojection support into uDig. I am not quite sure what I am doing wrong. I tried to look at the raster reprojection support in GeoServer-WCS, but I couldn't see anything revealing there -- perhaps I missed it.
Here is my basic workflow:
1. Transform the viewport's bounding box ("viewportBBox") into something the WMS will understand ("requestBBox")
2. Retrieve image from WMS
3. Wrap the image up in a GridCoverage2D, giving it the "requestBBox" and the request's CRS
4. Create a map context and set its AreaOfInterest to the viewportBBox/CRS
5. Call paint on LiteRenderer2, giving it the bounding box of the viewport. (I am unsure what BBox to give it here - the javadocs say nothing!)
However, this doesn't seem to actually reproject the raster. The image that appears on screen is exactly the same as I get back from the WMS.
(See attached image)
Here is what my code looks like:
GridCoverageFactory factory = new GridCoverageFactory();
GridCoverage gc = factory.create(
"GridCoverage",
image,
CRS.decode(findRequestCRS()), //is this right?
gtRequestBBox); //or should this be viewportBBox??
Rectangle paintArea = new Rectangle(getOffset().x, getOffset().y, dimension.width, dimension.height);
MapContext mapContext = new DefaultMapContext();
mapContext.addLayer(gc, style);
mapContext.setAreaOfInterest(getViewportBBox(), getViewportCRS()); //is this right?
LiteRenderer2 lite = new LiteRenderer2(mapContext);
lite.paint(destination, paintArea, getViewportBBox());
Thanks for any help,
Richard