[R-sig-Geo] writeRaster: BSQ despite BIL is requested

Roger Bivand Roger@Biv@nd @ending from nhh@no
Wed Dec 19 11:51:57 CET 2018


On Wed, 19 Dec 2018, Agustin Lobo wrote:

> I do
>
> writeRaster(testin,
> file="testin",format="ENVI",datatype="INT2U",bandorder="BIL",overwrite=TRUE)
>
> but get an image with BSQ order
> (rda object: https://www.dropbox.com/s/or5h7yb9nd52e94/testin.rda?dl=0)

Which version of GDAL is under all of this? It doesn't matter here, but 
might have mattered.

raster::writeRaster() puts interleave = bsq in the *.hdr files. "BIP" and 
does not seem to do anything. However:

writeGDAL(as(testin, "SpatialGridDataFrame"), fname="testinsp.envi", 
drivername="ENVI", type="UInt16", options="INTERLEAVE=BIL", 
setStatistics=TRUE)

yields interleave = bil in the *.hdr file. Using the same route, I get:

writeRaster(testin, file="testin", format="ENVI", datatype="INT2U", 
options="INTERLEAVE=BIL", overwrite=TRUE)

with interleave = bil in the *.hdr file. I'm not sure where 
raster::writeRaster() drops the options definitions given in bandorder=, 
maybe ENVI is not a 'native' file format?

Hope this helps,

Roger


> Thanks
> Agus
>
> R version 3.5.0 (2018-04-23)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Debian GNU/Linux buster/sid
>
> Matrix products: default
> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
>
> locale:
> [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
> LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
> LC_MONETARY=en_GB.UTF-8
> [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C
>               LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_2.7-15 rgdal_1.3-6   sp_1.3-1
>
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en



More information about the R-sig-Geo mailing list