CoordinateOperationFactory cof = commonFactory.getCoordinateOperationFactory(); CoordinateOperation coordOp = cof.createOperation(pointCRS, myCRS); MathTransform mt = coordOp.getMathTransform();
/** * Attempts to find a transform from the current CRS to the new CRS and * creates a new geometry by invoking that transform on each control point * of this geometry. */ public final Geometry transform(final CoordinateReferenceSystem newCRS) throws TransformException { try { BasicFactories commonFactory = BasicFactories.getDefault(); CoordinateOperationFactory cof = commonFactory.getCoordinateOperationFactory(); CoordinateReferenceSystem oldCRS = getCoordinateReferenceSystem(); CoordinateOperation coordOp = cof.createOperation(oldCRS, newCRS); MathTransform mt = coordOp.getMathTransform(); return transform(newCRS, mt); } catch (OperationNotFoundException e) { throw new TransformException("Unable to find an operation", e); } catch (FactoryException e) { throw new TransformException("Factory exception", e); } }