[R-sig-Geo] combining polygons from shapefiles...
Sean O'Riordain
seanpor at acm.org
Wed Dec 2 15:56:51 CET 2009
Good afternoon,
I've been making good progress in the last few weeks thanks to this
list, along with Roger and Adrians' books and some great geo-packages.
I'm trying to combine some shapefiles...
library(maptools)
CA <- readShapePoly('ca.shp')
LA <- readShapePoly('la.shp')
Now I want to combine these two into a bigger object...
I've searched the books and the internet and I've tried a number of
things... including...
> class(LA)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
> class(CA)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
>
> S1 <- unionSpatialPolygons(CA, LA)
Loading required package: gpclib
General Polygon Clipper Library for R (version 1.4-4)
Type 'class ? gpc.poly' for help
Error in unionSpatialPolygons(CA, LA) : input lengths differ
>
>
> S1 <- spRbind(CA, LA)
Error in spRbind(as(obj, "SpatialPolygons"), as(x, "SpatialPolygons")) :
non-unique polygon IDs
>
Any ideas please?
Thanks in advance!
Sean
More information about the R-sig-Geo
mailing list