Pis*_*ean 14 java geometry jts computational-geometry
我们可以使用坐标列表创建一个LineString,如下所示:
Geometry g1 = new GeometryFactory().createLineString(coordinates);
Run Code Online (Sandbox Code Playgroud)
我们如何使用坐标列表创建多边形?
提前致谢.
bug*_*123 28
在2012年,接受的答案可能仍然有效(仍然很尴尬),但现在你真的应该这样做:
// Create a GeometryFactory if you don't have one already
GeometryFactory geometryFactory = new GeometryFactory();
// Simply pass an array of Coordinate or a CoordinateSequence to its method
Polygon polygonFromCoordinates = geometryFactory.createPolygon(coordinates);
Run Code Online (Sandbox Code Playgroud)
Pis*_*ean 12
使用以下代码行:
GeometryFactory fact = new GeometryFactory();
LinearRing linear = new GeometryFactory().createLinearRing(coordinates);
Polygon poly = new Polygon(linear, null, fact);
Run Code Online (Sandbox Code Playgroud)
我希望它会有所帮助:)