TypeTwo
2014-Jun-15 15:04 UTC
[R] Problem with converting a list of grids to a list of polygons
Hi. For a spatial analysis (its visualization) I need to produce a map of conditions and traits. When I used SpatialPixelsDataFrame (sp package) my grid cells were regular and between each row was a small gap, which is not only messy but incorrect. So I generated the coords of each grid from the centroids in order to elongate the cells manually (or does anybody know another way to solve this?). But I got stuck when I tried to convert the XMIN, XMAX, YMIN, YMAX - corner points to a list of polygons (and keeping at least the ID as individuell reference). I really don?t get it, how can I read data of this format as a list of polygons? ?head"(ID, XMIN, XMAX, YMIN, YMAX, lat, lng, altc_mean) polys <- Polygons(list(Polygon(assemblage[,c("XMIN", "XMAX", "YMIN", "YMAX?)])), ID=assemblage$ID) SP <- SpatialPolygons(polys) SPDF <- SpatialPolygonsDataFrame(SP, data=data.frame(x= assemblage$lng, yassemblage$lat, row.names=row.names(SP))) Already thanks for your help, Stefan -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-converting-a-list-of-grids-to-a-list-of-polygons-tp4692142.html Sent from the R help mailing list archive at Nabble.com.