[GRASS-dev] [grass-code I][405] r.out.gdal sets NoData wrong

Hamish hamish_nospam at yahoo.com
Wed May 23 01:41:10 EDT 2007


> code I item #405, was opened at 2007-05-23 00:27
[cc g-dev]
..
> Summary: r.out.gdal sets NoData wrong 
..
> r.out.gdal sets NoData wrong. Example, in spearfish60:

need to set
  GDALSetRasterNoDataValue(GDALRasterBandH hBand, double dfValue) 	

 http://www.gdal.org/gdal_8h.html#763e876f9b4c3f2b4bae2816af572fd2

"To clear the nodata value, just set it with an "out of range" value."


> Note that r.out.gdal.sh is buggy too (or actually the gdal_translate,
> which it calls), though in a different way:
> 
> $ r.out.gdal.sh check out=check.tif type=Byte
> $ gdalinfo -mm check.tif | grep 'NoData\|Min'
>     Computed Min/Max=0.000,255.000
>   NoData Value=256
> 
> There should be no NoData, as there is no null in the input GRASS
> raster. Value 256 is not present in input "check" at all. Moreover,
> 256 is beyond GDAL's "Byte" value range.


The needed gdal_translate option is
       -a_nodata value:
           Assign a specified nodata value to output bands.

Hamish




More information about the grass-dev mailing list