[R-sig-Geo] rbind of SpPolDFs

Agustin Lobo alobolistas at gmail.com
Tue May 18 16:23:40 CEST 2010


Hi!

I have a set of shapefiles, each one with one single polygon, and I
want to end up with one single SpPolDF including all polygons.
I read the set of shapefiles with readOGR() and thus get one SpPolDF
for each polygon.
I (unsuccessfully)  try:
> delme <- rbind.SpatialPolygonsDataFrame(BesosBoundary,TerBoundary)
Error in validObject(.Object) :
  invalid class "SpatialPolygons" object: non-unique Polygons ID slot values
Calls: rbind.SpatialPolygons ... SpatialPolygons -> new -> initialize
-> initialize -> validObject

> delme <- rbind.SpatialPolygonsDataFrame(BesosBoundary[1],TerBoundary[1])
Error in validObject(.Object) :
  invalid class "SpatialPolygons" object: non-unique Polygons ID slot values
Calls: rbind.SpatialPolygonsDataFrame ... SpatialPolygons -> new ->
initialize -> initialize -> validObject

> delme <- rbind.SpatialPolygonsDataFrame(BesosBoundary at polygons,TerBoundary at polygons)
Error in as(x, "SpatialPolygons") :
  no method or default for coercing "list" to "SpatialPolygons"
Calls: rbind.SpatialPolygonsDataFrame -> do.call -> lapply -> FUN -> as

and some other variants.

Any help on how to do this? A solution would be using joinPolys from
maptools (the polygons do not overlap), but think that
rbind.SpatialPolygonsDataFrame() is better suited for this operation.

Agus



More information about the R-sig-Geo mailing list