Hi,

I ran into a problem in subsetting the Mainland from a usa map

Library(maps)
usa=map('usa',plot=F,fill=T)
IDs=sapply(strsplit(state$names,':'), function(x) x[1])
crs=CRS('+proj=longlat +ellps=WGS84')
sp.usa=map2SpatialPolygons(usa,IDs=usa$names,proj4string=crs)

since sp.usa consists of a group of lands and I only need the mainland, then

mainland=slot(sp.usa,'polygons')[[3]]
class(mainland)
[1] "Polygons"
attr(,"package")
[1] "sp"

The question is how to transform 'mainland' back into SpatialPolygons format. 

Any advice would be appreciated.

Weidong Gu, 

University of Alabama, Birmingham

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to