[R-sig-Geo] [R-sig-geo] problem to convert a complex "SpatialPolygonsDataFrame" to owin

Adrian Baddeley Adrian.Baddeley at csiro.au
Mon Feb 7 08:22:57 CET 2011


gianni lavaredo <gianni.lavaredo at gmail.com> wrote on R-sig-geo:

>  I wish to convert a really complex  "SpatialPolygonsDataFrame" to owin using

>  MyMask<- readOGR(".", "Mask")
>  MyMask.owin<- as(MyMask, "owin")

>  but I get this error massage in the end

>  Errore in matrix(FALSE, npoly, npoly) : too many elements specified

This error is flagged by the package 'spatstat' which is attempting to check whether any pair of polygons is overlapping. Apparently there are so many polygons ('npoly') that the system can't create a logical matrix of size npoly * npoly. That is indeed a lot of polygons (e.g. my laptop will accept npoly = 25,000).

To avoid this error, you could try setting

           spatstat.options(checkpolygons=FALSE)

which will simply turn off the checking. Do this if you are confident that the polygons do not overlap.

Good luck!
Adrian Baddeley



More information about the R-sig-Geo mailing list