Hi, I have a data.frame with the vertices (lon / lat) and codes from several squares (more than 500 in the real dataset). I want to create an object with these polygons (squares) and after this export it as a shapefile. With the script below I can draw one square. library(sp) P1 = Polygon(vertices[1:4,1:2]) Ps1 = SpatialPolygons(list(Polygons(list(P1), ID = "1")), proj4string=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")) plot(Ps1, axes = TRUE)
Now I'm trying to create one object with all squares at once. Is it possible? Thanks a lot, Antônio Olinto sample data:vertices lon lat cod 1 -33 -23 1 2 -32 -23 1 3 -32 -22 1 4 -33 -22 1 5 -32 -23 2 6 -31 -23 2 7 -31 -22 2 8 -32 -22 2 9 -31 -23 3 10 -30 -23 3 11 -30 -22 3 12 -31 -22 3 13 -33 -22 4 14 -32 -22 4 15 -32 -21 4 16 -33 -21 4 17 -32 -22 5 18 -31 -22 5 19 -31 -21 5 20 -32 -21 5 21 -31 -22 6 22 -30 -22 6 23 -30 -21 6 24 -31 -21 6 [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo