coerce-gpc-methods {polyCub} | R Documentation |
"owin"
and "gpc.poly"
Package polyCub implements converters between the classes
"owin"
of package spatstat and
"gpc.poly"
of package rgeos
(originally from gpclib).
Support for the "gpc.poly"
class was dropped from
spatstat as of version 1.34-0.
owin2gpc(object) gpc2owin(object, ...) as.owin.gpc.poly(W, ...)
object |
an object of class |
... |
further arguments passed to |
W |
an object of class |
The converted polygon of class "gpc.poly"
or "owin"
,
respectively. If neither package rgeos nor gpclib are available,
owin2gpc
will just return the pts
slot of the
"gpc.poly"
(no formal class) with a warning.
The converter owin2gpc
requires the package rgeos (or
gpclib) for the formal class definition of a "gpc.poly"
.
It will produce vertices ordered according to the sp convention,
i.e. clockwise for normal boundaries and anticlockwise for holes, where,
however, the first vertex is not repeated!
Sebastian Meyer
xylist
, and the package rgeos for
conversions of "gpc.poly"
objects from and to sp's
"SpatialPolygons"
class.
if (gpclibPermit() && require("spatstat")) { ## use example polygons from example(plotpolyf, ask = FALSE) letterR # a simple "xylist" letterR.owin <- owin(poly = letterR) letterR.gpc_from_owin <- owin2gpc(letterR.owin) letterR.xylist_from_gpc <- xylist(letterR.gpc_from_owin) stopifnot(all.equal(letterR, lapply(letterR.xylist_from_gpc, "[", 1:2))) letterR.owin_from_gpc <- as.owin(letterR.gpc_from_owin) stopifnot(all.equal(letterR.owin, letterR.owin_from_gpc)) }