[R-sig-Geo] Issue with as.polygonal (gpclib disabled?)

"José M. Blanco Moreno" jmblanco at ub.edu
Fri Jan 28 19:05:00 CET 2011


Dear R users,
I have been trying to convert a mask owin object (generated by dilation) 
to a polygonal owin, but I am facing the following error message, and I 
have not been able to find the solution, neither among the 
documentation, nor in the mailing lists. Any hint? I know that some 
packages (one package, perhaps) have changed recently (months ago) their 
default behaviour with regards to gpclib, and I wonder if spatstats is 
one of these.
Thank you in advance,
José M.

##############################
 > library(spatstat); library(gpclib)

 > pins <- cbind(x=rnorm(60),y=rnorm(60))

 > pins <- as.data.frame(pins)

 > pins.owin <- owin(poly=pins[rev(chull(pins)),])

 > pins.dil <- dilation(pins.owin,r=0.25)

 > pins.dil <- simplify.owin(dilation(pins.owin,r=0.25))
# Warning message:
# In as.polygonal(W) :
#   Can't convert mask to polygon: gpclib is disabled/unavailable

 > perimeter(pins.dil)
# Error in as.psp.owin(p) : x is a mask
# In addition: Warning messages:
# 1: In as.polygonal(w) :
#   Can't convert mask to polygon: gpclib is disabled/unavailable
# 2: In as.polygonal(W) :
#  Can't convert mask to polygon: gpclib is disabled/unavailable

##############################
## However I can execute the following example from gpclib
 > holepoly <- read.polyfile(system.file("poly-ex/hole-poly.txt", package =
+ "gpclib"), nohole = FALSE)

 > area.poly(holepoly)

 > sessionInfo()
R version 2.11.0 (2010-04-22)
i386-pc-mingw32

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] gpclib_1.5-1    spatstat_1.21-0 deldir_0.0-12   mgcv_1.7-1

loaded via a namespace (and not attached):
[1] grid_2.11.0        lattice_0.19-13    Matrix_0.999375-44 nlme_3.1-97
[5] tools_2.11.0

-- 
---------------------------------------
José M. Blanco-Moreno

Dept. de Biologia Vegetal (Botànica)
Facultat de Biologia
Universitat de Barcelona
Av. Diagonal 645
08028 Barcelona
SPAIN
---------------------------------------

phone: (+34) 934 039 863
fax: (+34) 934 112 842



More information about the R-sig-Geo mailing list