<dependency> <groupId>org.locationtech.jts</groupId> <artifactId>jts-core</artifactId> <version>1.17.0</version> </dependency> import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.CoordinateTransform; import org.locationtech.jts.geom.CoordinateTransformFactory; import org.locationtech.jts.geom.DefaultCoordinateSequenceFactory; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.locationtech.jts.io.WKTReader; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.MathTransform; public class CoordinateTransformationExample { public static void main(String[] args) throws Exception { Coordinate startCoordinate = new Coordinate(116.3975, 39.9085); CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326"); CoordinateTransformFactory factory = new CoordinateTransformFactory(); CoordinateTransform transform = factory.createTransform(startCRS, targetCRS); Coordinate transformedCoordinate = transform.transform(startCoordinate); } }


上一篇:
下一篇:
切换中文