[GRASS-user] GRASS export GeoTiff adventure... continued :-)
Markus Metz
markus_metz at gmx.de
Sun Aug 3 12:12:41 EDT 2008
Nikos Alexandris wrote:
> Markus,
> I appreciate it that you clarify the details.
>
It seems I try but fail. Something is still wrong...
>> If you remove the associated
>> colour table, r.out.gdal writes a completely black colour table.
>> Applications that read the colour table will consequently show a
>> completely black image, but the true values are still there. I think
>> this is a bug in r.out.gdal.
>> If there is no colour table, no colour
>> table should be written to the output file at all, because only then
>> would other applications use the real values to display the image. Fixed
>> after removing lines 208 and 210 in raster/r.out.gdal/main.c and
>> compiling again, GRASS 6.3.0
>> The lines read:
>> line 208
>> hCT = GDALCreateColorTable(GPI_RGB);
>> line 210
>> GDALSetRasterColorTable(hBand, hCT);
>>
>
> Did you already filed a ticket for that?
>
Not yet, will do.
> So nodata=255 does not mean "loss of information"?
> The red, green, blue channels are 8-bit (2 high 8 = 256, values counting
> from 0 up to 255).
>
It means that NULL cells in the GRASS raster are replaced with 255 or
the specified nodata value.
> One example report for an image imported with r.in.gdal, MASKed,
> r.colors -r, r.out.gdal as a group with nodata=-9999:
> Driver: GTiff/GeoTIFF
> Files: simmern_2624_5548.tiff
> simmern_2624_5548.tiff.aux.xml
> Size is 2500, 2500
> Coordinate System is:
> PROJCS["Transverse Mercator",
> GEOGCS["bessel",
> DATUM["Deutsches_Hauptdreiecksnetz",
> SPHEROID["Bessel 1841",6377397.155,299.1528128000008,
> AUTHORITY["EPSG","7004"]],
> AUTHORITY["EPSG","6314"]],
> PRIMEM["Greenwich",0],
> UNIT["degree",0.0174532925199433]],
> PROJECTION["Transverse_Mercator"],
> PARAMETER["latitude_of_origin",0],
> PARAMETER["central_meridian",6],
> PARAMETER["scale_factor",1],
> PARAMETER["false_easting",2500000],
> PARAMETER["false_northing",0],
> UNIT["metre",1,
> AUTHORITY["EPSG","9001"]]]
> Origin = (2624000.000000000000000,5550000.000000000000000)
> Pixel Size = (0.800000000000000,-0.800000000000000)
> Metadata:
> AREA_OR_POINT=Area
> Image Structure Metadata:
> INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left ( 2624000.000, 5550000.000) ( 7d43'56.88"E, 50d 4'28.10"N)
> Lower Left ( 2624000.000, 5548000.000) ( 7d43'54.54"E, 50d 3'23.39"N)
> Upper Right ( 2626000.000, 5550000.000) ( 7d45'37.42"E, 50d 4'26.59"N)
> Lower Right ( 2626000.000, 5548000.000) ( 7d45'35.05"E, 50d 3'21.88"N)
> Center ( 2625000.000, 5549000.000) ( 7d44'45.97"E, 50d 3'54.99"N)
> Band 1 Block=2500x1 Type=Byte, ColorInterp=Red
> NoData Value=-9999
> Metadata:
> COLOR_TABLE_RULES_COUNT=5
> COLOR_TABLE_RULE_RGB_0=0.000000e+00 4.640000e+01 255 255 0 0 255 0
> COLOR_TABLE_RULE_RGB_1=4.640000e+01 9.280000e+01 0 255 0 0 255 255
> COLOR_TABLE_RULE_RGB_2=9.280000e+01 1.392000e+02 0 255 255 0 0 255
> COLOR_TABLE_RULE_RGB_3=1.392000e+02 1.856000e+02 0 0 255 255 0 255
> COLOR_TABLE_RULE_RGB_4=1.856000e+02 2.320000e+02 255 0 255 255 0 0
> Band 2 Block=2500x1 Type=Byte, ColorInterp=Green
> NoData Value=-9999
> Metadata:
> COLOR_TABLE_RULES_COUNT=5
> COLOR_TABLE_RULE_RGB_0=0.000000e+00 4.680000e+01 255 255 0 0 255 0
> COLOR_TABLE_RULE_RGB_1=4.680000e+01 9.360000e+01 0 255 0 0 255 255
> COLOR_TABLE_RULE_RGB_2=9.360000e+01 1.404000e+02 0 255 255 0 0 255
> COLOR_TABLE_RULE_RGB_3=1.404000e+02 1.872000e+02 0 0 255 255 0 255
> COLOR_TABLE_RULE_RGB_4=1.872000e+02 2.340000e+02 255 0 255 255 0 0
> Band 3 Block=2500x1 Type=Byte, ColorInterp=Blue
> NoData Value=-9999
> Metadata:
> COLOR_TABLE_RULES_COUNT=5
> COLOR_TABLE_RULE_RGB_0=3.400000e+01 7.320000e+01 255 255 0 0 255 0
> COLOR_TABLE_RULE_RGB_1=7.320000e+01 1.124000e+02 0 255 0 0 255 255
> COLOR_TABLE_RULE_RGB_2=1.124000e+02 1.516000e+02 0 255 255 0 0 255
> COLOR_TABLE_RULE_RGB_3=1.516000e+02 1.908000e+02 0 0 255 255 0 255
> COLOR_TABLE_RULE_RGB_4=1.908000e+02 2.300000e+02 255 0 255 255 0 0
>
>
I have one last idea. Type is Byte, but NoData Value=-9999, out of range
for Byte. Maybe that causes a problem? Can you try with nodata=0, then
NULL cells in the GRASS raster should appear black in the GeoTIFF?
If that fails too, maybe it's the COLOR_TABLE_RULE entries. Then try
data type = INT16, not UINT16, after removing the colour table with
r.colors -r, this should remove both any colour table and these colour
table rule entries in the GeoTIFF metadata.
Good luck!
More information about the grass-user
mailing list