Hello list,
 
I’m trying to create a SpatialPolygonsDataFrame from an object of class list 
(x), which has coordinates for contour lines in Albers equal area (full 
parameters below). I’m executing the following code:
 
CRSdata <- "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 
+y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +towgs84=0,0,0"
sldf <- ContourLines2SLDF(x)
proj4string(sldf) <- CRS(CRSdata)
ps <- SpatialLines2PolySet(sldf)
 
#so far so good; continue:
 
sp <- PolySet2SpatialPolygons(ps)
 
# I get the following error: 
 
Error in PolySet2SpatialPolygons(ps) : unknown coordinate reference system
 
#what I was hoping to continue executing (which works great with UTM data sets 
where I defined attr(ps,”projection”) <- “UTM” and attr(ps,”zone”) <- “17N”) 
 is:
 
dataframe <- as.data.frame(matrix(as.character(1,nrow=1,ncol=1)))
spdf <- SpatialPolygonsDataFrame(sp,dataframe,match.ID=TRUE)
 
Because Albers isn’t “UTM” nor “LL” I’m not sure what projection to specify for 
the PolySet object (i.e., attr(ps,”projection”)) in order to properly convert 
PolySet2SpatialPolygons. Any thoughts or suggestions?  I would also welcome any 
comments if I’m using an unnecessary long code to convert the list of contour 
line x/y points into a spatial polygon with the goal of calculating its area in 
R and exporting it into an ESRI shapefile.
 
Thanks!
Sharon
 
Sharon Baruch-Mordo
Ph.D. Candidate in Ecology
Dept. of Fish, Wildlife, and Conservation Biology
Colorado State University
Fort Collins, CO 80523-1474
Phone: 970-491-7020  
Fax: 970-491-5091
E-mail: sharonbm@warnercnr.colostate.edu
http://www.warnercnr.colostate.edu/research/bear



      
	[[alternative HTML version deleted]]

