/** * Convert geometry to different coordinate system given the source/target proj4 parameters. * Presumably these were pulled from SPATIAL_REF_SYS. * * @param geom * @param srcParams * @param tgtParams * @return * @throws Exception */ public static Geometry transform(Geometry geom, String srcParams, String tgtParams) throws Exception { CoordinateTransformFactory ctFactory = new CoordinateTransformFactory(); CRSFactory crsFactory = new CRSFactory(); CoordinateReferenceSystem srcCrs = crsFactory.createFromParameters(null, srcParams); CoordinateReferenceSystem tgtCrs = crsFactory.createFromParameters(null, tgtParams); CoordinateTransform coordTransform = ctFactory.createTransform(srcCrs, tgtCrs); return transformGeometry(coordTransform, geom); }