why gIntersection is giving TopologyException if both polygons are valid?

爷,独闯天下 提交于 2019-12-11 04:56:50

问题


I'm trying

set97 <- gIntersection(setbp,d97)

and getting the error message:

Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, "rgeos_intersection") : 
  TopologyException: found non-noded intersection between LINESTRING (533036 -314770, 533036 -314770) and LINESTRING (533036 -314780, 533036 -314770) at 533035.88110651996 -314769.97350772272

(setbp is a sector of a county - for census purposes - and d97 is the deforestation in brazilian Amazon up to 1997.) When I do

gIsValid(d97)
gIsValid(setbp)
gIntersects(setbp,d97)

I get TRUE for all three questions. So, what's wrong? I'll try gBuffer with 0 width (it solves some of these issues), but I'd like to understand what's going on.

EDIT: gBuffer didn't work. @mdsumner suggested me to do the gIntersection row by row, but up to now (after trying 3 different methods), it didn't work either (look at the comments). Stranger yet, the TopologyException is being caused by strange "strips" of geometry not detected by gIsValid, and worse yet, kilometers apart from the intersecting polygon (setbp above, setbpi in the comments). I'll try the function shown here, though it doesn't seem a rounding problem.

来源:https://stackoverflow.com/questions/18018097/why-gintersection-is-giving-topologyexception-if-both-polygons-are-valid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!