* Markus Neteler <neteler@osgeo.org> [2018-07-15 20:49:32 +0200]:
On Mon, Jul 9, 2018 at 10:53 AM, Nikos Alexandris
<nik@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?
Markus, you mean a "boolean" to report presence/absence?
What about getting the actual name of the color table?
And a `-p Print name or rules of the assigned color table" flag?
If the map has one of the pre-defined color table rules assigned,
print the name of the rules (one that is part of the `-l` list).
If the rules are custom, print "custom [rules]".
Or print the rules themselves?
`-l` and `-d` flags where recently worked on, if I recall correctly.
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"
?
"-w Create color table only if none [yet] assigned"
or
"-w Create color table only if non assigned"
Personally I would prefer the word map to be included.
Thank you Markus, Nikos