使用Geotools绘制了不正确的LineString

问题描述 投票:0回答:1

我正在尝试使用geotools在地球上画一条线,但是绘制画线时,它并没有考虑两点之间的最短距离,而是在地球上走了很长的路,并提供了错误的结果。谷歌地图上的一条线正确绘制了生成的路线。黑白地图正在使用geotools,另一幅是从google maps。有人可以指出我我要去哪里了PS:坐标在对数中,lat

 Coordinate[] myLineString = new Coordinate[]{
                new Coordinate( -110.0,20.0),
                new Coordinate( 143.41666666666666,41.583333333333336 ),
                new Coordinate(  140.8,41.65)
        };
    Hints hints = new Hints(Hints.CRS, DefaultGeographicCRS.WGS84);
    GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(hints);
    LineString lineString = geometryFactory.createLineString(coordinates);

enter image description here

enter image description here

java gis geotools jts
1个回答
1
投票

简单的答案是因为您使用的EPSG:4326具有+/- 180度的不连续性。因此,您的行以“显而易见”的方式表示。

© www.soinside.com 2019 - 2024. All rights reserved.