### Name: as.SpatialPolygons.PolygonsList
### Title: Making SpatialPolygons objects
### Aliases: as.SpatialPolygons.PolygonsList as.SpatialPolygons.Shapes
###   as.SpatialPolygons.map as.SpatialPolygons.pal
### Keywords: spatial

### ** Examples

## Not run: 
##D library(maptools)
##D nc.shp <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
## End(Not run)
data(ncshp)
nc1 <- as.SpatialPolygons.Shapes(nc.shp$Shapes, as.character(nc.shp$att.data$FIPS))
plotSpatialPolygons(nc1)
invisible(text(getSpPPolygonsLabptSlots(nc1), labels=getSpPPolygonsIDSlots(nc1), cex=0.6))
## Not run: 
##D library(maps)
##D ncmap <- map("county", "north carolina", fill=TRUE, col="transparent", plot=FALSE)
## End(Not run)
data(ncmap)
IDs <- sapply(strsplit(ncmap$names, "[,:]"), function(x) x[2])
nc2 <- as.SpatialPolygons.map(ncmap, IDs)
plotSpatialPolygons(nc2)
invisible(text(getSpPPolygonsLabptSlots(nc2), labels=getSpPPolygonsIDSlots(nc2), cex=0.6))
## Not run: 
##D library(RArcInfo)
##D fl <- "http://www.census.gov/geo/cob/bdy/co/co90e00/co37_d90_e00.zip"
##D download.file(fl, "co37_d90_e00.zip")
##D e00 <- zip.file.extract("co37_d90.e00", "co37_d90_e00.zip")
##D e00toavc(e00, "nc")
##D arc <- get.arcdata(".", "nc")
##D pal <- get.paldata(".", "nc")
##D pat <- get.tabledata("info", "NC.PAT")
## End(Not run)
data(co37_d90_arc)
data(co37_d90_pal)
sapply(pal[[2]], function(x) length(x[[1]]))
data(co37_d90_pat)
IDs <- paste(pat$ST[-1], pat$CO[-1], sep="")
nc3 <- as.SpatialPolygons.pal(arc, pal, IDs=IDs)
plotSpatialPolygons(nc3)
invisible(text(getSpPPolygonsLabptSlots(nc3), labels=getSpPPolygonsIDSlots(nc3), cex=0.6))



