[R-sig-Geo] invalid class “SpatialPolygons” object: non-unique Polygons ID slot values

Agustin Lobo alobolistas at gmail.com
Sat Dec 21 12:16:57 CET 2013


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
>



More information about the R-sig-Geo mailing list