[R-sig-Geo] gIntersection returns error "TopologyException: no outgoing dirEdge found at"
Jean-Luc Dupouey
dupouey at nancy.inra.fr
Wed Sep 23 19:10:45 CEST 2015
Why gIntersection returns the ""TopologyException: no outgoing dirEdge
found at" error in the following very simple case:
> #construct a spatial layer with two adjacent squares, each of 10 x 10
units:
>
> Pol1=rbind(c(0,0),c(0,10),c(10,10),c(10,0),c(0,0))
> Pol2=rbind(c(0,0),c(10,0),c(10,-10),c(0,-10),c(0,0))
>
> Pols1=Polygons(list(Polygon(Pol1)),"Pols1")
> Pols2=Polygons(list(Polygon(Pol2)),"Pols2")
> MyLay=SpatialPolygons(list(Pols1,Pols2))
>
> #construct the same layer, but lagged by 0.5 in x and y directions
>
> Pol1l=Pol1+0.5
> Pol2l=Pol2+0.5
>
> 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)
>
> #try to intersect:
>
> inter=gIntersection(MyLay,MyLayl)
Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_lower_td,
"rgeos_intersection") :
TopologyException: no outgoing dirEdge found at 0.5 0
It works with the option byid=TRUE.
But my question is why it does not work without? Is this behaviour
predictable?
I went through some previous related posts to the list, but could not
find the answer.
Thanks,
--
Jean-Luc Dupouey
INRA
Forest Ecology & Ecophysiology Unit
F-54280 Champenoux
France
mail: dupouey at nancy.inra.fr
More information about the R-sig-Geo
mailing list