[R-sig-Geo] Wrong layer names written with writeRaster() (package raster)

Agustin Lobo alobolistas at gmail.com
Thu Sep 5 10:47:27 CEST 2013


Envi and GTiff files (at least) do not keep the names of the brick object:

> require(rgdal)
Loading required package: rgdal
rgdal: version: 0.8-10, (SVN revision 478)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.0, released 2013/04/24
Path to GDAL shared files: /usr/share/gdal/1.10
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: (autodetected)

require(raster)
m <- raster(matrix(10,ncol=10,nrow=10))
bm <- brick(m,m,m)
names(bm) <- paste("Pepa",1:3,sep="")
names(bm)
writeRaster(bm,"delme",format="ENVI",bandorder="BSQ",datatype="INT2S",overwrite=TRUE)

in the hdr file:
  band names = {
    Band 1,
    Band 2,
    Band 3}

Is this a bug?
Thanks,
Agus


> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8
LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
LC_ADDRESS=C               LC_TELEPHONE=C
LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgdal_0.8-10  raster_2.1-37 sp_1.0-9

loaded via a namespace (and not attached):
 [1] colorspace_1.2-2   dichromat_2.0-0    digest_0.6.3
ggplot2_0.9.3.1    grid_2.15.2        gtable_0.1.2       labeling_0.2
     lattice_0.20-13    MASS_7.3-23
[10] munsell_0.4        plyr_1.8           proto_0.3-10
RColorBrewer_1.0-5 reshape2_1.2.2     scales_0.2.3       stringr_0.6.2
     tools_2.15.2



More information about the R-sig-Geo mailing list