Note: This document is for an older version of GRASS GIS that has been discontinued. You should upgrade, and read the current manual page.
v.greedycolors works best if areas have unique categories. If multiple areas have the same category, the corresponding network of neighboring areas can become fairly complex, resulting in a larger number of greedy colors. If the purpose is to assign different colors to neighboring areas, irrespective of their category values, unique category values need to be assigned first, e.g. to a new layer with v.category.
There is always at least one optimal solution for greedy colors, using as few colors as possible. However, it is usually computationally intensive and not practical to search for an optimal solution. Therefore a good solution is aproximated by ordering the areas first, before assigning greedy colors. Here, the areas with the least neighbors are processed first.
Make a copy of the data:
g.copy vect=boundary_county,my_boundary_county
v.greedycolors map=my_boundary_county
db.select sql="select greedyclr,count(greedyclr) from my_boundary_county group by greedyclr"
greedyclr|count(greedyclr) 1|262 2|351 3|302 4|11
Assign RGB colors:
v.db.addcolumn map=my_boundary_county column="GRASSRGB varchar(11)" v.db.update map=my_boundary_county column=GRASSRGB value="127:201:127" where="greedyclr = 1" v.db.update map=my_boundary_county column=GRASSRGB value="190:174:212" where="greedyclr = 2" v.db.update map=my_boundary_county column=GRASSRGB value="253:192:134" where="greedyclr = 3" v.db.update map=my_boundary_county column=GRASSRGB value="255:255:153" where="greedyclr = 4"
Available at: v.greedycolors source code (history)
Latest change: Friday Nov 12 20:59:19 2021 in commit: c015f7c704bebad8d7710d25cd5ed6d211d5ee26
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
© 2003-2023 GRASS Development Team, GRASS GIS 7.8.9dev Reference Manual