Reputation: 15
I want to stack and write some Landsat bands/tiff files to BIP interleave in ENVI format. However, the results always come as BSQ, even though I change the bandorder to BIP.
Below is my code:
library(raster)
library(rgdal)
library(gdalUtils)
inbands <-list.files(pattern= "*.tif")
stk<-stack(inbands[2], inbands[3], inbands[4])
writeRaster(stk, "BIP_test", format="ENVI", bandorder='BIP')
writeRaster(stk, "BIP_test", format="ENVI", options="INTERLEAVE=PIXEL", overwrite=TRUE)
Any assistance is appreciated.
Upvotes: 0
Views: 1988
Reputation: 442
I think this should work:
writeRaster(stk, "BIP_test", format="ENVI", options="INTERLEAVE=BIP", overwrite=TRUE)
per the GDAL formats page on the ENVI format, "BIP" (not "PIXEL") is the argument to "INTERLEAVE". Based on my reading of the WriteRaster
helpfile, bandorder='BIP'
only works for the raster package's native file format.
Upvotes: 2