WKTHelper { public static Geometry transform(final Geometry geometry, final String sourceSRS, final String targetSRS) { if (geometry == null || sourceSRS == null || targetSRS == null) { return null; } try { CoordinateReferenceSystem sourceCRS = getCRS(sourceSRS); CoordinateReferenceSystem targetCRS = getCRS(targetSRS); return transform(geometry, sourceCRS, targetCRS); } catch (Exception ex) { log.error(ex, "Couldn't transform geometry to new projection"); } return null; }  static Geometry transform(final Geometry geometry, final String sourceSRS, final String targetSRS); static Geometry transform(final Geometry geometry, final CoordinateReferenceSystem sourceCRS,
                                     final CoordinateReferenceSystem targetCRS); static String transform(final String wkt, final String sourceSRS, final String targetSRS); static String transformLayerCoverage(final String wkt, final String targetSRS); static String getWKT(Geometry geometry); static Geometry parseWKT(final String wkt); static Geometry parseWKT(final String wkt, GeometryFactory gf); static CoordinateReferenceSystem getCRS(final String srs); static String getBBOX(final double westBoundLongitude, final double southBoundLatitude,
                                 final double eastBoundLongitude, final double northBoundLatitude); final static String PROJ_EPSG_4326; final static String PROJ_EPSG_3067; final static CoordinateReferenceSystem CRS_EPSG_4326; }
@Test public void testTransform() throws Exception { Geometry point = WKTHelper.parseWKT("POINT (24.938466 60.170014)"); Geometry transformed = WKTHelper.transform(point, WKTHelper.PROJ_EPSG_4326, WKTHelper.PROJ_EPSG_3067); assertTrue("Got point from " + transformed, transformed != null); assertEquals(6672130.96106858, transformed.getCoordinate().y, 1e-9); assertEquals(385615.37435276626, transformed.getCoordinate().x, 1e-9); }