[GRASS-dev] r.out.gdal: GeoTIFF colortable malformed?

Maciej Sieczka tutey at o2.pl
Sun Mar 11 17:31:52 EDT 2007


Glynn Clements wrote:
> Maciej Sieczka wrote:

>> GeoTIFFs exported with r.out.gdal appear blank in QGIS 0.8 [1].

> Did you specify type=Byte or type=UInt16?

On https://svn.qgis.org/trac/ticket/643 you can read it was:

r.out.gdal input=vegcover format=GTiff type=Byte output=vegcover.tif

> The default for CELL maps is
> Int32, and a 2^32 entry palette isn't feasible.
> 
> 	$ r.out.gdal vegcover format=GTiff output=vegcover.tif
> 	ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
> 	Done!
> 
> [gdalinfo shows no colour table.]
> 
> 	$ r.out.gdal vegcover format=GTiff output=vegcover.tif type=Byte
> 	Done!
> 
> [gdalinfo shows a colour table.]
> 
> Even with type=, the COLOR_TABLE_RULE* values are bogus; all entries
> have zero for start, end and intensities:
> 
>   COLOR_TABLE_RULES_COUNT=6
>   COLOR_TABLE_RULE_RGB_0=0.000000e+00 0.000000e+00 0 0 0 0 0 0
>   COLOR_TABLE_RULE_RGB_1=0.000000e+00 0.000000e+00 0 0 0 0 0 0
>   COLOR_TABLE_RULE_RGB_2=0.000000e+00 0.000000e+00 0 0 0 0 0 0
>   COLOR_TABLE_RULE_RGB_3=0.000000e+00 0.000000e+00 0 0 0 0 0 0
>   COLOR_TABLE_RULE_RGB_4=0.000000e+00 0.000000e+00 0 0 0 0 0 0
>   COLOR_TABLE_RULE_RGB_5=0.000000e+00 0.000000e+00 0 0 0 0 0 0
> 
> This is because:
> 
> 1. vegcover doesn't use colour rules but a fixed palette:
> 
> 	#0 first color
> 	255 255 255
> 	0
> 	255 0 0
> 	255 255 0
> 	255 128 0
> 	0 0 255
> 	255 0 255
> 	0 255 0
> 
> [spearfish57/PERMANENT/colr/vegcover]
> 
> 2. r.out.gdal is using the maximum value as the number of rules (hence
> the COLOR_TABLE_RULES_COUNT=6) rather than the value returned by
> G_colors_count().
> 
> I've committed a fix for point #2, so vegcover.tif won't have
> COLOR_TABLE_RULES_COUNT or COLOR_TABLE_RULE_RGB_* tags.

Thank you. I'll report back when I try the fixed version.

Regards,
Maciek




More information about the grass-dev mailing list