Skip to content
Prev 23439 / 29559 Next

gIntersection returns error "TopologyException: no outgoing dirEdge found at"

Thanks for your answer. Unfortunately, I have no time to spend debugging 
the GEOS code. Just making some tests under R, I found an even worse 
situation, where the program seems to work, but gives a completely false 
result:

library(sp)
library(rgeos)

#build a first polygon, MyLay, composed of two adjacent squares, size 1x1:

Pol1=rbind(c(0,0),c(0,1),c(1,1),c(1,0),c(0,0))
Pol2=rbind(c(0,0),c(1,0),c(1,-1),c(0,-1),c(0,0))

Pols1=Polygons(list(Polygon(Pol1)),"Pols1")
Pols2=Polygons(list(Polygon(Pol2)),"Pols2")
MyLay=SpatialPolygons(list(Pols1,Pols2))

#build a second polygon, MyLayl, composed of the same two squares lagged 
by 0.1 in x and y directions:

Pol1l=Pol1+0.1
Pol2l=Pol2+0.1

Pols1l=Polygons(list(Polygon(Pol1l)),"Pols1l")
Pols2l=Polygons(list(Polygon(Pol2l)),"Pols2l")
MyLayl=SpatialPolygons(list(Pols1l,Pols2l))

#view the resulting spatial layers:

plot(MyLay)
plot(MyLayl,add=TRUE)

#"successful" intersection:

inter=gIntersection(MyLay,MyLayl)

#but false result: the intersection gives the same contour as MyLay!

plot(MyLay)
plot(MyLayl,add=TRUE)
plot(inter,col="red",add=TRUE)

I use R version 3.2.2, rgeos_0.3-12 and sp_1.2-0.

If such an error occurs when crossing larger spatial layers, it will 
remain undetectable.

If I am not wrong, it implies that this software is not very reliable. 
Especially when considering that byid=FALSE is the default option.

gIntersection gives a correct result using the option byid=TRUE. The 
intersect function of the raster package also gives a correct 
intersection. Do you think this latter function could be a better 
option, in general?

Thanks in advance,

Jean-Luc Dupouey

INRA
Forest Ecology & Ecophysiology Unit
F-54280 Champenoux
France
mail: dupouey at nancy.inra.fr

Le 23/09/2015 19:39, Roger Bivand a ?crit :

Thread (15 messages)

Jean-Luc Dupouey gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 23 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 23 Jean-Luc Dupouey gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Edzer Pebesma gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Vijay Lulla gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Edzer Pebesma gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Edzer Pebesma gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Vijay Lulla gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 25 Edzer Pebesma gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 26 Roger Bivand gIntersection returns error "TopologyException: no outgoing dirEdge found at" Sep 26