spatstat (version 1.21-4)

gpc2owin: Convert Polygonal Region into Different Format

Description

Conversion between the different representations of a polygonal region in the packages spatstat and gpclib.

Usage

gpc2owin(x)
 owin2gpc(x)

Arguments

x
Object representing a polygonal region. An object of class "owin" in the spatstat package (for owin2gpc) or an object of class "gpc.poly" in the gpclib package (for gpc2owin

Value

  • An object of class "owin" in the spatstat package (for gpc2owin) or an object of class "gpc.poly" in the gpclib package (for owin2gpc).

Details

The packages spatstat and gpclib have slightly different internal formats for representing a polygonal region in the two-dimensional plane. In gpclib a polygonal region is an object of class "gpc.poly", while in spatstat it is an object of class "owin" and of type "polygonal". These two functions convert the two formats: owin2gpc converts an "owin" to a "gpc.poly", while gpc2owin does the reverse. Conversion of a "gpc.poly" to an "owin" can also be performed by calling as.owin.

See Also

as.owin

Examples

Run this code
data(letterR)
   if(spatstat.options("gpclib") && require(gpclib)) {
     R <- owin2gpc(letterR)
     L <- gpc2owin(R)
   } else cat("gpclib is not available
")

Run the code above in your browser using DataCamp Workspace