[R-sig-Geo] How to export a GeoTIFF 8 bit raster

Rik Ferreira r|k|erre|r@@|ve@ @end|ng |rom gm@||@com
Sun Jan 30 16:51:51 CET 2022


Hello!

How a raster image can be exported as a 8 bit GeoTIFF image?

I'm downloading a 8 bit image from this link:
http://geoinfo.cnps.embrapa.br/documents/2918/download, cropping it with a
vector mask, treating it, and exporting it with terra package (writeRaster
function).

However, the original image is a GeoTIFF with 8 bit depth but the output
image (terra package, writeRaster function) is a 32 bit image.

I can control it with `gdal = "NBITS=8"` argument to writeRaster but i get
such warning:

Warning message:
> In x using ptr$writeRaster(opt) :
>   GDAL Message 6:
> /mnt/HDD/STORAGE/r-projects/raster-bit-depth/output/recorte.tif: Only
> NBITS=16 is supported for data type Float32
>

How can I export this raster as a 8 bit GeoTIFF image with terra package?

-- 
Rik Ferreira Alves
Graduando em Geografia - Unimontes
https://rikferreira.netlify.app/

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list