Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cld<- raster("cdl_30m_r_il_2014_albers.tif") #this is the large raster
- r<- stack(paste(path,"/data_robin/", fl,sep="")) #1 stack,I have 4000 similar
- mat<-as.data.frame(getValues(r)) # getting values from the stack
- xy<-xyFromCell(r,c(1:ncell(r)),spatial = TRUE)
- clip1 <- crop(cld, extent(r)) # Tried to crop it to a smaller size
- cells<-cellFromXY(clip1,xy)
- mat$landuse<- NA
- # mat$landuse<-cld[cells]
- mat$landuse<- extract(clip1,cells) #this line takes 5 mins based on profiling
- > cld
- class : RasterLayer
- dimensions : 20862, 11758, 245295396 (nrow, ncol, ncell)
- resolution : 30, 30 (x, y)
- extent : 378585, 731325, 1569045, 2194905 (xmin, xmax, ymin, ymax)
- coord. ref. : +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0
- data source : /Users/kaswani/R/Image/cdl_30m_r_il_2014_albers.tif
- names : cdl_30m_r_il_2014_albers
- values : 0, 255 (min, max)
- > r
- class : RasterStack
- dimensions : 9230, 7502, 69243460, 4 (nrow, ncol, ncell, nlayers)
- resolution : 0.7995722, 0.7995722 (x, y)
- extent : 589084.4, 595082.8, 1564504, 1571884 (xmin, xmax, ymin, ymax)
- coord. ref. : +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
- names : m_3608906_ne_16.1, m_3608906_ne_16.2, m_3608906_ne_16.3, m_3608906_ne_16.4
- min values : 0, 0, 0, 0
- max values : 255, 255, 255, 255
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement