[GRASS-dev] Report assigned color table for a map

Markus Neteler neteler at osgeo.org
Sun Jul 15 11:49:32 PDT 2018


On Mon, Jul 9, 2018 at 10:53 AM, Nikos Alexandris
<nik at nikosalexandris.net> wrote:
> How do we know a map has already a color table assigned?
> Wouldn't this be "important" to have it reported by `r.info`, for example?

Yes, would make sense to me (also in r3.info).

This code snippet may do it (raster/r.colors/edit_colors.c, line 322:)

# for r.info:
int have_colors;
have_colors = Rast_read_colors(name, mapset, &colors);


# for r3.info
int have_colors;
have_colors = Rast3d_read_colors(name, mapset, &colors);

Would you write a patch?

> Also, `r.colors` does "-w Only write new color table if it does not
> already exist". But how do we report an "existing" color table (of
> course, except of manually checking if a map's name file exists in
> colr)?
>
> By the way, maybe this one message can be changed to:
> "-w  Create only if the map has no color table assigned"

maybe something like
"-w  Create color table only none yet assigned"

?

Markus


More information about the grass-dev mailing list