我的github

That being said, you will want to ensure the geometries are valid before computing the intersection, using polygon1.isValid() and polygon2.isValid(). The sample data for polygon2 is self-intersecting, so the intersection operation fails with

com.vividsolutions.jts.geom.TopologyException: found non-noded intersection between LINESTRING ( 2.0 0.0, 2.0 2.0 ) and LINESTRING ( 1.0 1.0, 2.5 1.5 ) [ (2.0, 1.3333333333333333, NaN) ]

参考:https://stackoverflow.com/questions/51322693/geotools-calculate-intersection-area-between-two-geometries-needed

posted on 2023-06-06 14:34  XiaoNiuFeiTian  阅读(605)  评论(0编辑  收藏  举报