[R-sig-Geo] rgeos::gDifference

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Jan 5 13:00:50 CET 2015


When running the following script:

library(sp)
gt = GridTopology(cellcentre.offset = c(0,0), cellsize = c(1,1),
	cells.dim = c(3,3))
sgdf = SpatialGridDataFrame(SpatialGrid(gt),
    data.frame(r = round(runif(9, max = 10), 1)))

gt = GridTopology(cellcentre.offset = c(.25,.25), cellsize = c(1,1),
	cells.dim  = c(1,1))
grd.red = SpatialGrid(gt)

library(rgeos)
sp1 = as(sgdf, "SpatialPolygonsDataFrame")
sp2 = as(grd.red, "SpatialPolygons")

plot(sp1, axes = TRUE)
plot(sp2, border = 'red', add = TRUE)

dif = gDifference(sp2, gUnionCascaded(sp1))
dif = gDifference(sp2, sp1)


the last command gives the following error:

Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
"rgeos_difference") :
  TopologyException: no outgoing dirEdge found at -0.25 -0.25
Calls: gDifference -> RGEOSBinTopoFunc -> .Call
Execution halted

What does this mean? Why does gUnionCascaded(sp1) not do this?
-- 
Edzer Pebesma,  Co-Editor-in-Chief Computers & Geosciences
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150105/174af282/attachment.bin>


More information about the R-sig-Geo mailing list