I only recently started playing with shapefiles and R packages for manipulating them. I am looking at creating a new shapefile based on merged polyons by following this example, however, I cannot seem to figure out what I am suppose to feed the as.data.frame("youData").
Using the Zambia shapefiles as an example, how would one go about creating a new shapefile composed of a superset district-level data?
require(maptools)
require(rgadl)
zambia <- readShapeSpatial("ZMB_adm2.shp")
zambiap <- unionSpatialPolygons(zambia, ID=zambia@data$ID_1)
zambiapd <- SpatialPolygonsDataFrame(ob,data=as.data.frame("yourData"),proj4string=CRS("+proj= aea > +ellps=GRS80 +datum=WGS84"))
writeOGR(zambiapd,"shapes","testShape",driver="ESRI Shapefile",)
No comments:
Post a Comment