R raster raster with several stripes

I want to create a subset of an image with four stripes. Therefore, I use the crop function in R.

A<-raster("L8_stacked.tif")
subset<-extent(c(639451, 660104, 5469254, 5489566))
B<-crop(A,subset)

As a result, I get a single-band raster in the .tif file. Do I have to define other parameters to get a 4-range subset image?

+4
source share
1 answer

As already noted in the comments, the function raster()returns an object (one) RasterLayer. If you need a multilayer raster object, you need to use the function stack()or brick()load the image into RIe:

A <- stack("L8_stacked.tif")

crop(), , .

, .

+4

All Articles