[GRASS-dev] [GRASS GIS] #3119: r.out., gdal -c should not write Metadata: COLOR_TABLE_RULE_RGB

#3119: r.out.,gdal -c should not write Metadata: COLOR_TABLE_RULE_RGB
-------------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-trunk
Keywords: r.out.gdal | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
At time, when suppressing the color table export (eg when writing out in
GeoTIFF format) with

  r.out.gdal -c ...

still the metadata are written:

{{{
   Metadata:
     COLOR_TABLE_RULES_COUNT=5
     COLOR_TABLE_RULE_RGB_0=1.000000e+00 1.122440e+04 255 255 0 0 255 0
     COLOR_TABLE_RULE_RGB_1=1.122440e+04 2.244780e+04 0 255 0 0 255 255
     COLOR_TABLE_RULE_RGB_2=2.244780e+04 3.367120e+04 0 255 255 0 0 255
     COLOR_TABLE_RULE_RGB_3=3.367120e+04 4.489460e+04 0 0 255 255 0 255
     COLOR_TABLE_RULE_RGB_4=4.489460e+04 5.611800e+04 255 0 255 255 0 0
}}}

The code is here:

https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.out.gdal/export_band.c#L315

Perhaps the if condition here should also consider
"suppress_main_colortable"?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3119&gt;
GRASS GIS <https://grass.osgeo.org>

#3119: r.out.,gdal -c should not write Metadata: COLOR_TABLE_RULE_RGB
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.out.gdal
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

Replying to [ticket:3119 neteler]:
> At time, when suppressing the color table export (eg when writing out
in GeoTIFF format) with
>
> r.out.gdal -c ...
>
> still the metadata are written:
>
> {{{
> Metadata:
> COLOR_TABLE_RULES_COUNT=5
> COLOR_TABLE_RULE_RGB_0=1.000000e+00 1.122440e+04 255 255 0 0 255 0
> COLOR_TABLE_RULE_RGB_1=1.122440e+04 2.244780e+04 0 255 0 0 255 255
> COLOR_TABLE_RULE_RGB_2=2.244780e+04 3.367120e+04 0 255 255 0 0 255
> COLOR_TABLE_RULE_RGB_3=3.367120e+04 4.489460e+04 0 0 255 255 0 255
> COLOR_TABLE_RULE_RGB_4=4.489460e+04 5.611800e+04 255 0 255 255 0 0
> }}}
>
> The code is here:
>
>
https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.out.gdal/export_band.c#L315
>
> Perhaps the if condition here should also consider
"suppress_main_colortable"?

The new 'm' flag suppresses writing out GRASS color rules to metadata in
order to enhance compatibility with other GIS software not using GDAL
(r69128-30 for trunk, relbr72, relbr70).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3119#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3119: r.out.,gdal -c should not write Metadata: COLOR_TABLE_RULE_RGB
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.out.gdal
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by neteler):

Thanks.

Just an idea: should -c trigger -m automatically or is there any -c use
case where the GRASS color rules are still wanted in the metadata?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3119#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3119: r.out.,gdal -c should not write Metadata: COLOR_TABLE_RULE_RGB
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.out.gdal
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

Replying to [comment:2 neteler]:
> Thanks.
>
> Just an idea: should -c trigger -m automatically or is there any -c use
case where the GRASS color rules are still wanted in the metadata?

The main purpose of -c is to suppress those long color tables for UInt16
in GTiff: one separate entry for each possible value which makes rendering
very slow. GTiff color tables and GRASS color rules are not the same, e.g.
a simple GRASS color rule such as

{{{
0 black
255 white
}}}

is expanded to 256 entries for Byte. GRASS r.in.gdal prefers GRASS color
rules as custom metadata over standard color tables, therefore these GRASS
color rules are wanted also with the -m flag. BTW, earlier versions of
QGIS also recognized these GRASS color rules. Format-dependent color
tables as such are not custom metadata, the GDAL driver decides if the
selected format supports color tables. Therefore I would regard the -c and
-m flags as independent of each other.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3119#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3119: r.out.,gdal -c should not write Metadata: COLOR_TABLE_RULE_RGB
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.3
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.out.gdal
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by mmetz):

* status: new => closed
* resolution: => fixed

Comment:

Closing as fixed.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3119#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>