@Test public void testTransformToWGS84() throws Exception { String wkt = "GEOGCS[\"GDA94\"," + " DATUM[\"Geocentric Datum of Australia 1994\"," + " SPHEROID[\"GRS 1980\", 6378137.0, 298.257222101, AUTHORITY[\"EPSG\",\"7019\"]]," + " TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], " + " AUTHORITY[\"EPSG\",\"6283\"]], " + " PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]]," + " UNIT[\"degree\", 0.017453292519943295], " + " AXIS[\"Geodetic longitude\", EAST], " + " AXIS[\"Geodetic latitude\", NORTH], " + " AXIS[\"Ellipsoidal height\", UP], " + " AUTHORITY[\"EPSG\",\"4939\"]]"; CoordinateReferenceSystem gda94 = CRS.parseWKT(wkt); ReferencedEnvelope bounds = new ReferencedEnvelope3D( 130.875825803896, 130.898939990319, -16.4491956225999, -16.4338185791628, 0.0, 0.0, gda94); ReferencedEnvelope worldBounds = JTS.toGeographic(bounds); assertEquals(DefaultGeographicCRS.WGS84, worldBounds.getCoordinateReferenceSystem()); Envelope envelope = new Envelope( 130.875825803896, 130.898939990319, -16.4491956225999, -16.4338185791628); Envelope worldBounds2 = JTS.toGeographic(envelope, gda94); if (worldBounds2 instanceof BoundingBox) { assertEquals( DefaultGeographicCRS.WGS84, ((BoundingBox) worldBounds2).getCoordinateReferenceSystem()); } }
public static Envelope toGeographic( final Envelope envelope, final CoordinateReferenceSystem crs) throws TransformException { if (CRS.equalsIgnoreMetadata(crs, DefaultGeographicCRS.WGS84)) { if (envelope instanceof ReferencedEnvelope) { return envelope; } return ReferencedEnvelope.create(envelope, DefaultGeographicCRS.WGS84); } ReferencedEnvelope initial = ReferencedEnvelope.create(envelope, crs); return toGeographic(initial); }
JTS { public static Envelope toGeographic( final Envelope envelope, final CoordinateReferenceSystem crs) throws TransformException { if (CRS.equalsIgnoreMetadata(crs, DefaultGeographicCRS.WGS84)) { if (envelope instanceof ReferencedEnvelope) { return envelope; } return ReferencedEnvelope.create(envelope, DefaultGeographicCRS.WGS84); } ReferencedEnvelope initial = ReferencedEnvelope.create(envelope, crs); return toGeographic(initial); } }
JTS { public static Envelope toGeographic( final Envelope envelope, final CoordinateReferenceSystem crs) throws TransformException { if (CRS.equalsIgnoreMetadata(crs, DefaultGeographicCRS.WGS84)) { if (envelope instanceof ReferencedEnvelope) { return envelope; } return ReferencedEnvelope.create(envelope, DefaultGeographicCRS.WGS84); } ReferencedEnvelope initial = ReferencedEnvelope.create(envelope, crs); return toGeographic(initial); } private  JTS(); }
JTS { public static Envelope toGeographic( final Envelope envelope, final CoordinateReferenceSystem crs) throws TransformException { if (CRS.equalsIgnoreMetadata(crs, DefaultGeographicCRS.WGS84)) { if (envelope instanceof ReferencedEnvelope) { return envelope; } return ReferencedEnvelope.create(envelope, DefaultGeographicCRS.WGS84); } ReferencedEnvelope initial = ReferencedEnvelope.create(envelope, crs); return toGeographic(initial); } private  JTS(); static Envelope transform(final Envelope envelope, final MathTransform transform); static Envelope transform(
            final Envelope sourceEnvelope,
            Envelope targetEnvelope,
            final MathTransform transform,
            int npoints); static ReferencedEnvelope3D transformTo3D(
            final ReferencedEnvelope sourceEnvelope,
            CoordinateReferenceSystem targetCRS,
            boolean lenient,
            int npoints); static ReferencedEnvelope transformTo2D(
            final ReferencedEnvelope sourceEnvelope,
            CoordinateReferenceSystem targetCRS,
            boolean lenient,
            int npoints); static Geometry transform(final Geometry geom, final MathTransform transform); static Coordinate transform(
            final Coordinate source, Coordinate dest, final MathTransform transform); static Envelope toGeographic(
            final Envelope envelope, final CoordinateReferenceSystem crs); static ReferencedEnvelope toGeographic(final ReferencedEnvelope envelope); static void xform(final MathTransform transform, final double[] src, final double[] dest); static synchronized double orthodromicDistance(
            final Coordinate p1, final Coordinate p2, final CoordinateReferenceSystem crs); static DirectPosition toDirectPosition(
            final Coordinate point, final CoordinateReferenceSystem crs); static void copy(final Coordinate point, final double[] ordinates); static Geometry toGeometry(final Shape shape); static Geometry toGeometry(final Shape shape, final GeometryFactory factory); static Envelope2D getEnvelope2D(
            final Envelope envelope, final CoordinateReferenceSystem crs); static Point toGeometry(DirectPosition position); static Point toGeometry(DirectPosition position, GeometryFactory factory); static Polygon toGeometry(Envelope envelope); static Polygon toGeometry(final Envelope envelope, GeometryFactory factory); static ReferencedEnvelope toEnvelope(Geometry geom); static Polygon toGeometry(ReferencedEnvelope bbox); static Polygon toGeometry(BoundingBox bbox, GeometryFactory factory, int npoints); static Geometry toGeographic(Geometry geom, final CoordinateReferenceSystem crs); static Polygon toGeometry(BoundingBox bbox); static Polygon toGeometry(BoundingBox bbox, final GeometryFactory factory); static void checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs); static Geometry smooth(final Geometry geom, double fit); static Geometry smooth(final Geometry geom, double fit, final GeometryFactory factory); static CoordinateSequence createCS(
            CoordinateSequenceFactory csFactory, int size, int dimension); static CoordinateSequence createCS(
            CoordinateSequenceFactory csFactory, int size, int dimension, int measures); static ReferencedEnvelope bounds(Geometry geometry, CoordinateReferenceSystem crs); static Geometry removeCollinearVertices(final Geometry g); static Geometry removeCollinearVertices(final Geometry geometry, int minPoints); static List<Polygon> makeValid(Polygon polygon, boolean removeHoles); static Rectangle2D toRectangle2D(Envelope envelope); static Envelope toEnvelope(Rectangle2D rectangle); static Polygon toPolygon(java.awt.Polygon polygon); static Polygon toPolygon(java.awt.Rectangle rectangle); static Polygon toPolygon(Rectangle2D rectangle); static boolean equals(Envelope e1, Envelope e2, double tolerance); static boolean equals(BoundingBox a, BoundingBox b, double tolerance); }
JTS { public static Envelope toGeographic( final Envelope envelope, final CoordinateReferenceSystem crs) throws TransformException { if (CRS.equalsIgnoreMetadata(crs, DefaultGeographicCRS.WGS84)) { if (envelope instanceof ReferencedEnvelope) { return envelope; } return ReferencedEnvelope.create(envelope, DefaultGeographicCRS.WGS84); } ReferencedEnvelope initial = ReferencedEnvelope.create(envelope, crs); return toGeographic(initial); } private  JTS(); static Envelope transform(final Envelope envelope, final MathTransform transform); static Envelope transform(
            final Envelope sourceEnvelope,
            Envelope targetEnvelope,
            final MathTransform transform,
            int npoints); static ReferencedEnvelope3D transformTo3D(
            final ReferencedEnvelope sourceEnvelope,
            CoordinateReferenceSystem targetCRS,
            boolean lenient,
            int npoints); static ReferencedEnvelope transformTo2D(
            final ReferencedEnvelope sourceEnvelope,
            CoordinateReferenceSystem targetCRS,
            boolean lenient,
            int npoints); static Geometry transform(final Geometry geom, final MathTransform transform); static Coordinate transform(
            final Coordinate source, Coordinate dest, final MathTransform transform); static Envelope toGeographic(
            final Envelope envelope, final CoordinateReferenceSystem crs); static ReferencedEnvelope toGeographic(final ReferencedEnvelope envelope); static void xform(final MathTransform transform, final double[] src, final double[] dest); static synchronized double orthodromicDistance(
            final Coordinate p1, final Coordinate p2, final CoordinateReferenceSystem crs); static DirectPosition toDirectPosition(
            final Coordinate point, final CoordinateReferenceSystem crs); static void copy(final Coordinate point, final double[] ordinates); static Geometry toGeometry(final Shape shape); static Geometry toGeometry(final Shape shape, final GeometryFactory factory); static Envelope2D getEnvelope2D(
            final Envelope envelope, final CoordinateReferenceSystem crs); static Point toGeometry(DirectPosition position); static Point toGeometry(DirectPosition position, GeometryFactory factory); static Polygon toGeometry(Envelope envelope); static Polygon toGeometry(final Envelope envelope, GeometryFactory factory); static ReferencedEnvelope toEnvelope(Geometry geom); static Polygon toGeometry(ReferencedEnvelope bbox); static Polygon toGeometry(BoundingBox bbox, GeometryFactory factory, int npoints); static Geometry toGeographic(Geometry geom, final CoordinateReferenceSystem crs); static Polygon toGeometry(BoundingBox bbox); static Polygon toGeometry(BoundingBox bbox, final GeometryFactory factory); static void checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs); static Geometry smooth(final Geometry geom, double fit); static Geometry smooth(final Geometry geom, double fit, final GeometryFactory factory); static CoordinateSequence createCS(
            CoordinateSequenceFactory csFactory, int size, int dimension); static CoordinateSequence createCS(
            CoordinateSequenceFactory csFactory, int size, int dimension, int measures); static ReferencedEnvelope bounds(Geometry geometry, CoordinateReferenceSystem crs); static Geometry removeCollinearVertices(final Geometry g); static Geometry removeCollinearVertices(final Geometry geometry, int minPoints); static List<Polygon> makeValid(Polygon polygon, boolean removeHoles); static Rectangle2D toRectangle2D(Envelope envelope); static Envelope toEnvelope(Rectangle2D rectangle); static Polygon toPolygon(java.awt.Polygon polygon); static Polygon toPolygon(java.awt.Rectangle rectangle); static Polygon toPolygon(Rectangle2D rectangle); static boolean equals(Envelope e1, Envelope e2, double tolerance); static boolean equals(BoundingBox a, BoundingBox b, double tolerance); static final AffineTransformation Y_INVERSION; }