【问题标题】:How to find the Intersecting edges of a Polygon and a Line String in Java?如何在 Java 中找到多边形和线串的相交边?
【发布时间】:2014-02-28 02:45:42
【问题描述】:

我在java中使用JTS 我有一个 Polygon 和一个 LineString , 我可以很容易地找到 LineString 与 Polygon 相交的坐标。

  Geometry  intersections = polygon.intersection(line);
  for(Coordinate coor : intersections.getCoordinates()){
        System.out.println("Intersects at "+coor);
}

但我需要的是 LineString 与 Polygon 相交的 Polygon 边缘。 有什么方法或方法可以返回多边形与 Line 的相交边缘吗?

【问题讨论】:

    标签: jts


    【解决方案1】:

    我猜你可以得到多边形的边界,然后执行那个交集。像这样的东西:

    Geometry  intersections = polygon.getBoundary().intersection(line);
    for(Coordinate coor : intersections.getCoordinates()){
          System.out.println("Intersects at "+coor);
    }
    

    【讨论】:

      猜你喜欢
      • 2013-10-16
      • 2021-02-21
      • 2011-07-08
      • 2011-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-28
      相关资源
      最近更新 更多