[R-sig-Geo] converting bounding box to shapefile problem

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Jun 11 00:12:07 CEST 2011


On Fri, Jun 10, 2011 at 7:34 PM, mihai.niculita <mihai.niculita at uaic.ro> wrote:

> In my case spatpol.list[[i]] should have i spatial polygons, not only one as
> Barry say.

 Well, no, spatpol.list is a list of the same length as bbx.list. Each
element of spatpol.list, referred to as spatpol.list[[i]] is a single
spatial polygon (with four coordinates).

> 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.

You have to decide if you want to create 7 different shapefiles, one
for each of your grids and each containing one bounding box polygon,
or one shapefile with 7 features.

 You are very close to the first solution. A shapefile, and a
SpatialPolygonsDataFrame, contains 1 or more features, where each
feature has a geometry (the polygon) and some attributes (the data
frame). Currently you create your SpatialPOlygonsDataFrame from a
single geometry and a data frame (IDD) with 7 rows - these dont match.
You need to make sure that IDD is only *one* row.


Barry



More information about the R-sig-Geo mailing list