[GRASS5] r.out.tiff bug with binary maps

It seems that I have found a bug in r.out.tiff:
Exporting of binary maps seems to be broken.
Can anyone confirm this?

Test: Spearfish data set

g.region -dp
r.mapcalc "testmap=if(fields>1,1,null())"
d.rast testmap
# ... map looks ok

r.out.tiff -tp in=testmap out=testmap
display testmap.tif
# ... contains RGB = 255:0:127 *everywhere*

Same error with:
r.mapcalc "testmap=if(fields>1,2,null())"
r.out.tiff -tp in=testmap out=testmap
display testmap.tif

while
r.mapcalc "testmap=if(fields>1,1,0)"
r.out.tiff -tp in=testmap out=testmap
display testmap.tif

is somewhat ok.

So the NULL support fails for pallete '-p' and binary
maps. The export of more than one category and no data areas:

r.out.tiff -tp in=fields out=testmap
display testmap.tif

is correct. The r.out.tiff problem seems to be related to single
value maps with no data area and '-p' flag.

The '-p' flag is important as it is currently the only
way to export GRASS CELL raster maps (range of 0..255) which
allows for import with r.in.gdal as *single* map. Without
'-p' flag the Tiff Photometric Interpretation is set to
'RGB color' and r.in.gdal creates three bands...

No idea, how to fix '-p' for binary maps.

Markus

Markus Neteler wrote:

It seems that I have found a bug in r.out.tiff:
Exporting of binary maps seems to be broken.
Can anyone confirm this?

I get the behaviour which you describe for the CVS head, but not for
5.0.2. But the only difference between the two versions of
src/raster/r.tiff/r.out.tiff.c is a fix for the spelling of "Palette"
in the pflag->description string.

That suggests that it might be related to the behaviour of libgis
functions on which r.out.tiff depends.

--
Glynn Clements <glynn.clements@virgin.net>