[R-sig-Geo] creating polygons

Zev Ross zev at zevross.com
Tue Apr 21 21:19:18 CEST 2009


Hi Alina,

It sounds like you want to dissolve the zips based on their membership in a
district. If I have that right, then try the function unionSpatialPolygons. The
example from the help is below.

Zev


library(sp)
library(gpclib)
nc1 <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1],
 proj4string=CRS("+proj=longlat +datum=NAD27"))
lps <- coordinates(nc1)
ID <- cut(lps[,1], quantile(lps[,1]), include.lowest=TRUE)
reg4 <- unionSpatialPolygons(nc1, ID)
sapply(slot(reg4, "polygons"), function(i) slot(i, "ID"))



More information about the R-sig-Geo mailing list