Repository navigation
d.vect: Apply variable color only to area fill - #1146
wenzeslaus wants to merge 7 commits into
Conversation
Always use (respect) the color option for the area boundary and apply color table and other variable color options only to the area fill (as fill_color).
|
@landam Can you please comment both on the whether you agree with the change of behavior and on the correctness of the implementation? And/or suggest another reviewer. Works for me as expected with the vector color table, RGB column, cat-based random colors, and without any of those but color and fill color specified. |
|
Added images to the description and highlighted the controversy. |
|
Hi @wenzeslaus. I'm against this PR. I think, with only one option for an RGB column, the current behavior (same color for both area and boundary) is more expected. Also, leaving thin gaps would not be acceptable in some case. Why don't we split
Last, with this PR, |
|
I did a little test. By default, the current d.vect only draws points, lines, areas, and faces from the command line. From the GUI, it draws boundaries as well. I created a red-only RGB column To mimic your problem (no separate single boundary color), To overlay boundaries (what you want?), In d.vect, area borders are drawn by From the GUI, it just works because boundary is drawn by default using the Now, do we need variable colors for area borders (separate from fill colors) or boundaries (new)? That's a different story. |
|
@wenzeslaus Is this PR still relevant? I cannot reproduce this issue. From the NC sample mapset, g.copy vect=boundary_county,tmp --o
v.db.addcolumn map=tmp col="rgb_color varchar(50)"
v.db.update tmp col=rgb_color querycol="abs(random()%255) || ':' || abs(random()%255) || ':' || abs(random()%255)"
d.mon start=wx0
g.region vect=tmp
d.vect map=tmp rgb_column=rgb_color color=black type=area,boundary |
|
I was concerned with color table meaning the color rules saved with the map ( It still seems to behave the same when I use simple d.vect without checking the The behavior seems strange since the boundaries are part of areas in GRASS and they are rendered with |
|
@HuidaeCho Looking at comments here again, it seems your first and second test is the same, in both cases you ended up adding One use case for this would be the world map we show when GRASS GIS starts the first time. Using a workaround there would be okay-ish temporarily, but we don't want to keep using a workaround there. (Using RGB column there would be fine too in this case possibly lowering priority of this PR/problem.) So, I think this PR (or another fix) is still relevant. |
I see. You were not talking about the doesn't draw the area-color boundaries anymore. It uses the default solid color now and we lose the area-color boundary feature, which I believe we have to keep supporting. behaves consistently with your Let me summarize the current behavior without this PR. So the only time boundaries are drawn in their own single color is when areas are not assigned any colors either though What you need is again This is not a temporary workaround. It uses a feature of In the end, what would be the point of |
I would say that is a bug.
Lines 441-442 in |
|
First of all, I'm all for replacing this PR with something better. However, I have some concerns with what you are suggesting which will explain why I though it is only a workaround. The last two commands in your bigger example miss Your In this perspective, the width behavior makes perfect sense. This PR works with this understanding too. It changes the d.vect behavior so that it assumes not only you don't want centroid to be rendered by default, but newly also assumes that you want boundaries rendered in a constant color. Your approach seems to say that area for d.vect means skip not only centroids but also boundaries and render only what d.vect calls fill. In that case, I would say, boundary needs to be added to the defaults for type to achieve the expected behavior (and the boundaries with Both figures: Same world map with color table as above, but with # bottom
d.vect map=country_boundaries@with_color_table type=point,line,boundary,area,face color=0:29:57:255 width=11
# top
d.vect map=country_boundaries@no_color_table color=255:255:255:255 fill_color=none width=1 |
|
I found this sentence from the d.vect manual:
I think you're right that the original intention was to draw boundaries with areas by default. That's interesting. I always assumed based on the behavior of |
Just curious.. Is it intended? |
|
Bumping up milestone as 8.0.1 is due in two days, while this has not been part of RC1 and there has not been activity for some time. |
|
Solved conflicts |
|
I asked an AI agent (Claude Code) to read the discussion, reproduce the issue on current The change does what the description says, but it also changes the default output of What the PR doesArea boundaries are always drawn with Reproduction and verificationThe agent reproduced the bug on The same change also has two side effects:
What the agent tested (10 cases,
|
| # | d.vect options |
main |
This PR |
|---|---|---|---|
| 1 | rgb_column=rgb color=black |
Boundaries take the area color, so color=black is ignored (the reported bug). |
Black boundaries. |
| 2 | rgb_column=rgb (default color) |
Seamless fills. | Thin dark seams between areas. |
| 3 | rgb_column=rgb color=none |
Seamless fills. | Same as main. |
| 4 | rgb_column=rgb fill_color=none |
Per-feature colored outlines, no fill. | Plain color outlines, no fill. The colors are lost. |
| 5 | rgb_column=rgb color=black fill_color=none |
Colored outlines (color=black is ignored). |
Black outlines. |
| 6 | color table, color=black |
Boundaries in the area color. | Black boundaries. |
| 7 | color table, default color |
Seamless fills. | Thin dark seams. |
| 8 | -c color=black |
Boundaries in the area color. | Black boundaries. |
| 9 | zcolor=viridis color=black (3D map) |
Colored fill, boundaries in the area color. | Colored fill, black boundaries. zcolor still works for the fill. |
| 10 | color=blue fill_color=yellow (no variable color) |
Yellow fill, blue boundaries. | Identical to main. |
A side-by-side image of these renders is attached.

Not tested:
- wxGUI.
width/width_columninteraction.- Maps with islands.
- Combining
rgb_columnwith a color table.
What is left before merging
- CI. Checks were still queued or running when the agent looked.
- Documentation.
d.vect.mdshould describe the new behavior, in particular that variable colors no longer color the boundaries. - Comment fix in
area.c. The new comment is truncated ("... RGB col..."). - Test. There is none for this behavior. Rendering tests look hard here, so a manual test plan may be enough.
What is left to decide
- Is changing the default acceptable? HuidaeCho's objection (2021-03-02) is that area-colored boundaries are a feature, because they fill the gaps between neighbouring areas. wenzeslaus' reading is that the manual says areas are "outlined with
color", so the old behavior is a bug. Neither side has conceded the point. - If the old behavior should stay available, the options are:
- Keep the PR as is and add an opt-in for area-colored boundaries, for example the
-bflag HuidaeCho suggested. That would also bring back case 4, but only if the flag works together withfill_color=none. - Keep the old default and add an opt-in for fixed-color boundaries.
- Split
rgb_columninto fill and border columns, as HuidaeCho proposed on 2020-12-31.
- Keep the PR as is and add an opt-in for area-colored boundaries, for example the
- Case 4 needs to be part of that decision. Right now it silently stops working.
Opinion
Not ready to merge as is. The fix is correct for the reported problem, but it is a behavior change, not just a bug fix, and it removes one output that currently works (case 4). I'd merge it only after the maintainers agree on the default and on how people get the old rendering back, or after it is reworked as an opt-in.







Always use (respect) the color option for the area boundary and apply color table
and other variable color options only to the area fill (as fill_color).
Before
After
Previously, this was only possible by drawing the vector again using another layer (or vector map copy in case color table was used).
Trying to get old behavior with the new code
Unfortunately,
color=nonewhich disables drawing boundaries leaves thin white (bg color) lines in between the areas, so the old behavior cannot be exactly reproduced like that.