Opened 13 years ago

Last modified 6 years ago

#903 new enhancement

Category color in r.grow

Reported by: clerici Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Raster Version: 6.4.0 RCs
Keywords: r.grow Cc:
CPU: Unspecified Platform: All

Description

The r.grow command assign to the grown cells a new category as selected by user, but not a new color. The color is the same as one of the existing categories. For example, using the railroads map in Spearfish (in which the lines have the categories 1 and 2):

r.grow in=railroads ou=railroads.grown1 new=3

produces a three categories' map with the color of category 1 assigned to the new category 3.

Whith: r.grow in=railroads ou=railroads.grown2 new=4

produces a three categories' map with the color of category 2 assigned to the new category 4. With new=5 the color assigned is again the color 1, with new=6 the color 2 is assigned, and so on.
Same results with GRASS6.5, 6.4, 6.3 (with GRASS6.2 I didn't obtain any growing).

Change History (5)

comment:1 by hamish, 13 years ago

What it does is copy the color table from the input map and applies it to the output map.

When you use the new= option (or old=) with a value which is out of range of the old color table, the new value will probably be undefined in the old color table.

With GRASS 6.2 if you run "r.colors railroads.grown1 color=random" you will see that it did grow, just that the out-of-range color was previously coming out as white so you didn't see it.

With GRASS 6.3.0 and newer instead of undefined colors going to white it repeats the color table. If you try with the "roads" raster map and new=16, you can see the effect pretty well with d.legend.

I guess if those options are specified we could explicitly set old= to yellow and new= to red (similar to how r.buffer does) to at least set them to something.

Note if the input map's color table has a "default" (*) color defined in it this be will be used for undefined values instead of empties being filled by the cycling effect.

Hamish

comment:2 by clerici, 13 years ago

As a common user, I would simply expect a new table with a new different color for the new category. In other words something like the sequence:
r.grow in=railroads ou=railroads.grown1 new=3
r.colors railroads.grown1 color=random
though the best solution should be to mantain the original colors for the old categories.
The option old=to_color and new=new_color seems a good alternative option.

Many thanks

  1. Clerici

comment:3 by neteler, 10 years ago

Component: DefaultRaster
Milestone: 6.4.06.4.4
Platform: LinuxAll
Type: defectenhancement

comment:4 by hamish, 9 years ago

Keywords: r.grow added

comment:5 by neteler, 6 years ago

Milestone: 6.4.46.4.6
Note: See TracTickets for help on using tickets.