From: Ron L. <rli...@ya...> - 2013-03-12 10:59:00
|
Hello, I'm trying to rotate a map using the information in an earlier discussion: MapContent content = new MapContent(); // add layer(s), then... ReferencedEnvelope bounds = source.getBounds(); CoordinateReferenceSystem srcCRS =bounds.getCoordinateReferenceSystem(); // rotation by 45 degrees CCW AffineTransform rotation = AffineTransform.getRotateInstance(Math.PI / 4); MathTransform tr = new AffineTransform2D(rotation); // create a derived CRS (WARNING: LAST ARG IS A HACK !) DefaultDerivedCRS rotatedCRS = new DefaultDerivedCRS("rotated", srcCRS, tr,srcCRS.getCoordinateSystem()); // set the bounds of the viewport with the new CRS ReferencedEnvelope rotatedBounds = bounds.transform(rotatedCRS, true); MapViewport viewport = content.getViewport(); viewport.setBounds(rotatedBounds); The problem is that AffineTransform2D(rotation) does not return a MathTransform. How can I do that? I tried ProjectiveTransform but this distorts the final image. I'm using CRS 28992 (Dutch RD). It is in the context of StreamingRenderer: renderer.paint(graphics, imageBounds, rotatedBounds); Thanks for all your help. Ron |