[R] how to get points from SpatialPolygonsDataFrame

From: Milton Cezar Ribeiro <milton_ruser_at_yahoo.com.br>
Date: Sun, 3 Feb 2008 20:28:12 -0800 (PST)


Dear all,

I need to get all points for each polygons and save these points in a data.frame. I tryed to use the slot() function, but I canĀ“t access the "coords".

grd <- GridTopology(c(1,1), c(1,1), c(10,10)) polys <- as.SpatialPolygons.GridTopology(grd) centroids <- coordinates(polys)

x <- centroids[,1]
y <- centroids[,2]
z <- 1.4 + 0.1*x + 0.2*y + 0.002*x*x

ex_1.7 <- SpatialPolygonsDataFrame(polys, data=data.frame(x=x, y=y, z=z, row.names=sapply(slot(polys, "polygons"), function(i) slot(i, "ID")))) ex_1.7.selected<-ex_1.7[1,]
slot(ex_1.7.selected,"coords")

Any idea?

Kind regards,

Miltinho

 para armazenamento!

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 04 Feb 2008 - 04:32:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Feb 2008 - 07:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive