加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 当我们有坐标列表时,如何在JTS中创建一个多边形?

发布时间:2020-12-14 19:28:19 所属栏目:Java 来源:网络整理
导读:我们可以使用这样的坐标列表创建一个LineString: Geometry g1 = new GeometryFactory().createLineString(coordinates); 我们如何使用坐标列表创建多边形? 提前致谢. 解决方法 2012年接受的答案可能仍然有效(仍然很尴尬),但现在您应该这样做: // Create a
我们可以使用这样的坐标列表创建一个LineString:
Geometry g1 = new GeometryFactory().createLineString(coordinates);

我们如何使用坐标列表创建多边形?

提前致谢.

解决方法

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);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读