[R-sig-Geo] merging several shapefiles into one

Nicolas Degallier nicolas.degallier at ird.fr
Wed May 25 09:06:46 CEST 2011


Hi All,

I have read different shapefiles that are contiguous and that have different column names with the function "readShapePoly".

example :

noumea <- readShapePoly(noumea.file, IDvar = "NOUMEA2_ID", proj4string = crs_rgnc)

and

dumbea <- readShapePoly(dumbea.file, IDvar = "DUMBEA2_", proj4string = crs_rgnc)

Now I would like to create a new shapefile with all the polygones in the "noumea" and "dumbea" spatial polygone data frames.

I tried :
spRbind(noumea, dumbea)

I get this message error :

Error in spRbind(as(obj, "SpatialPolygons"), as(x, "SpatialPolygons")) :
 non-unique polygon IDs

I have tried with the function rbind()
I have tried to set noumea$NOUMEA2_ID and dumbea$DUMBEA2_ with unique values but I still get the same message error as if the function spRbind was not using those two columns as polygons ID...

Does anyone know how I can fix this problem ?

Thanks a lot

Nicolas


Nicolas Degallier

IRD UMR182
Laboratoire d'Océanographie et du Climat, Expérimentation et Approches Numériques (LOCEAN)
Tour 45-55, 4e ét., case 100, 4 place Jussieu
75252  Paris Cedex 5  France
tél: (33) 01 44 27 51 57
fax: (33) 01 44 27 38 05

E-mail: <Nicolas.Degallier at ird.fr>
pdf reprints:
http://www.locean-ipsl.upmc.fr/~ndelod/production/

Skype:"xuxaxu"



More information about the R-sig-Geo mailing list