0

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') 

This also did not work

writeRaster(stk, "BIP_test", format="ENVI",  options="INTERLEAVE=PIXEL", overwrite=TRUE) 

Any assistance is appreciated.

leppie
  • 115,091
  • 17
  • 196
  • 297
Ktelo
  • 5
  • 3

1 Answers1

2

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.

Alex Zvoleff
  • 442
  • 2
  • 13