hdr(x, format, extension='.wld')
format='WORLDFILE'
)writeRaster
to save a existing file in another format. But if you have a file in a 'raster' format (or similar), you can also only export a header file,
and use the data file (.gri) that already exists. writeHeader can write a VRT (GDAL virtual raster) header (.vrt); an ENVI or BIL header (.hdr) file; an Erdas Raw (.raw) header file; an IDRISI (.rdc) or SAGA (.sgrd).
This (hopefully) allows for reading the binary data (.gri), perhaps after changing the file extension, in other programs such as ENVI or ArcMap.writeRaster
, writeGDAL
r <- raster(system.file("external/test.grd", package="raster"))
r <- writeRaster(r, filename='export.grd')
hdr(r, format="ENVI")
Run the code above in your browser using DataLab