[GRASS-dev] r.out.gdal[.sh] sets null by force

Maciej Sieczka tutey at o2.pl
Sat May 12 16:45:59 EDT 2007


Hi,

I think there is a bug in r.out.gdal that it sets NoData wrong (GForge
is down, thus reporting directly to list). See:

$ r.mapcalc 'check=rand(0,256)'
$ r.info -rt check
min=0
max=255
datatype=CELL

$ r.out.gdal check out=check.tif type=Byte
$ r.in.gdal in=check.tif out=check_re
$ r.info -rt check_re
min=0
max=254
datatype=CELL

Rasters "check" and "check_re" have different max values. That's
because r.out.gdal sets 255 to null in "check.tif" by force:

$ gdalinfo -mm check.tif | grep 'NoData\|Min'
    Computed Min/Max=0.000,254.000
  NoData Value=255


As there is no null in original "check" raster, that should rather read:

    Computed Min/Max=0.000,255.000

and no "NoData".



Note that r.out.gdal.sh does:

$ r.out.gdal.sh check out=check2.tif type=Byte
$  gdalinfo -mm check2.tif | grep 'NoData\|Min'
    Computed Min/Max=0.000,255.000
  NoData Value=256

which is kind of strange too, as value 256 is not present in input
"check" at all, and 256 is beyond GDAL's "Byte" value range. But at
least it doesn't corrupt raster's max value.

Maciek




More information about the grass-dev mailing list