[GRASS-dev] [grass-code I][405] r.out.gdal sets NoData wrong
Maciej Sieczka
tutey at o2.pl
Wed May 23 16:26:10 EDT 2007
Hamish Bowman wrote:
>> Maciej Sieczka wrote:
>>>> 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."
Do you mean r.out.gdal needs to do it, or the user?
This is propably what gdal_translate (r.out.gdal.sh) does:
input is 0-255, type=Byte -> NoData=256:
$ r.mapcalc 'check=rand(0,256)'
$ r.info -rt check
min=0
max=255
datatype=CELL
$ 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
But, this is dirty anyway. I had no null in my input, so why should I
have NoData in the output? Like I wrote:
>>>> 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.
I saw GeoTIFFs without the NoData set, so should be possible in
general. But maybe GRASS raster -> GeoTIFF must have some NoData set
for some reason, ?. An issue in GDAL or GRASS?
>> The needed gdal_translate option is
>> -a_nodata value:
>> Assign a specified nodata value to output bands.
What would that help? I don't want NoData in the gdal_transalate
(r.out.gdal.sh) output at all, as there is no null in the input GRASS
raster.
Maciek
More information about the grass-dev
mailing list