I have been using the sp package to deal with gridded data. I would like to know how to extract the vertices (x,y) of polygons that outline areas of like-valued cells in a grid. Here is a simple 3x3 grid:
2 2 1 1 2 1 1 1 3 x <- c(1,1,1,2,2,2,3,3,3) # define a 3 x 3 array of points y <- c(1,2,3,1,2,3,1,2,3) h <- SpatialPoints(cbind(x,y)) # make these an sp object of the points class h$z<- c(1,1,2,1,2,2,1,1,3) # add field values gridded(h) <- T # make it a grid How could I get the vertices for the region of value=2 cells? Here is what they would be, in clockwise order from the upper left corner: (0,3) (2,3) (2,1) (1,1) (1,2) (0,2) Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler _at_ pnl.gov ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
