invalid class “SpatialPolygons” object: non-unique Polygons ID slot values
Looking at the code, x = rbind(x1, x2, x3, makeUniqueIDs = TRUE) ought to work, but I haven't tried. You are right that neither ?rbind nor ?rbind.SpatialPolygons tells you about this.
On 12/21/2013 12:16 PM, Agustin Lobo wrote:
Had looked into the vignette. No, it does not really help. spRbind() is only mentioned in "2.1 Dissolving Polygons" and not in "3.1 Combining Positional Data". Including an example where the "non-unique Polygons ID slot values" occurs in section 3.1. and the way to fix it using spRbind() would be very helpful. But having the same example in the help page also would be even better. I also find the Note "2. some rbind can accept objects with duplicated IDs,..." in the spRbind help page very confusing, as it is vague and the rbind help page does not mention spatial objects at all. The error I mention is frequent when combining SpPolDF objects that come from imported shapefiles and is probably rare in "only R" processing chains. Thanks for caring about this. Agus On Fri, Dec 20, 2013 at 8:14 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
On Fri, 20 Dec 2013, Agustin Lobo wrote:
Hi! I've got the "invalid class ?SpatialPolygons? object: non-unique Polygons ID slot values" error at trying to use rbind() (or spRbind()) with two spatial polygons dataframes that come from readOGR() of shapefiles. Not having done this operation in a long while, It took me quite a long time to remember about the spChFIDs() solution (i.e. http://r-sig-geo.2731867.n2.nabble.com/rbind-of-SpPolDFs-td5070215.html) despite the fact that the help page of spRbind() mentions the spChFIDs-methods. Could an example in which spChFIDs() has to be run be added to the Examples of the spRbind help page? Actually I think that the case in which 2 spatial polygons dataframes have independently assigned IDs (and thus most often require the spChFIDs step) is more common than the case of the current example and many users just remain confused looking at the error "invalid class ?SpatialPolygons? object: non-unique Polygons ID slot values".
Does:
library(maptools)
vignette("combine_maptools")
help?
Roger
Also, could the rbind() help page contemplate the case of sp objects? Thanks Agus
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Heisenbergstra?e 2, 48149 M?nster, Germany. Phone: +49 251 83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 555 bytes Desc: OpenPGP digital signature URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20131221/80886885/attachment.bin>