Skip to content
Prev 1118 / 29559 Next

conversion to polygons

On Mon, 19 Jun 2006, Luis Ridao Cruz wrote:

            
But what did you actually enter as the command before the error message, 
and what is str(coraltest)?

library(sp)
coraltest <- matrix(c(0,0,0,1,1,1,1,0,0,0), ncol=2, byrow=TRUE)
plot(coraltest, type="l")
SP_coraltest <- SpatialPolygons(list(Polygons(list(Polygon(coraltest)),ID=1)))
plot(SP_coraltest, axes=TRUE)

does work (one right bracket too many, and the inner constructor is 
Polygon()

Roger