[R-sig-Geo] converting bounding box to shapefile problem
mihai.niculita
mihai.niculita at uaic.ro
Fri Jun 10 20:34:03 CEST 2011
Thank you Barry and Roger,
You are right with the objects. This part from sp package I didn't
understood to well. My code is trying to obtain a list of
SpatialPolygonsDataFrame:
ID <- array(map.list, dim=c(7,1))
IDD <- as.data.frame(ID)
spatpol.list <- list()
polygon.list <- list()
spatpoldf.list <- list()
for(i in 1:length(bbx.list)) {
polygon.list[[i]] <- list(Polygons(list(Polygon(bbx.list[[i]])),
map.list[[i]]))
spatpol.list[[i]] <- SpatialPolygons(polygon.list[[i]])
spatpoldf.list[[i]] <- SpatialPolygonsDataFrame(spatpol.list[[i]], IDD,
match.ID = FALSE)
}
I mention that I want to process automatically almost 800 rasters. In this
case I had 7 rastesr, that's why ID is an array of 7 rows.
The sp documentation says for the above code:
"srl list with Polygon-class objects" == which in my script is
bbx.list[[i]]
"ID character vector of length one with identifier" == !!!!this I
didn't understood, and in my case I choose the vector with the names of arc
ascii grid files
"Srl list with objects of class Polygons-class" == which in my script
is polygon.list[[i]]
"pO integer vector; plotting order; if missing in reverse order of
Polygons area"
"Sr object of class SpatialPolygons-class" == which in my script is
spatpol.list[[i]]
"data object of class data.frame; the number of rows in data should
equal the"
number of Polygons-class objects in Sr" ==!!!!this I didn't
understood, and in my case I transformed the vector with the names of arc
ascii grid files in a matrix
"match.ID logical: (default TRUE): match SpatialPolygons member
Polygons ID slot values"
with data frame row names, and re-order the data frame
rows if necessary."
If character: indicates the column in data with Polygons
IDs to match"
In my case spatpol.list[[i]] should have i spatial polygons, not only one as
Barry say.
As a conclusion if some one can give me an example of how "ID" and "data"
should look I think I will resolve the problem.
-----
teaching assistant/phD student
Department of Geography
Faculty of Geography and Geology
University Al. I. Cuza
Iasi, Romania
email: mihai.niculita at uaic.ro
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/converting-bounding-box-to-shapefile-problem-tp6462495p6463373.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list