1v.colors(1) GRASS GIS User's Manual v.colors(1)
2
3
4
6 v.colors - Creates/modifies the color table associated with a vector
7 map.
8
10 vector, color table
11
13 v.colors
14 v.colors --help
15 v.colors [-rwldngac] map=name [layer=string] use=string [col‐
16 umn=name] [range=min,max] [color=style] [raster=name]
17 [raster_3d=name] [rules=name] [rgb_column=name] [--help] [--ver‐
18 bose] [--quiet] [--ui]
19
20 Flags:
21 -r
22 Remove existing color table
23
24 -w
25 Only write new color table if it does not already exist
26
27 -l
28 List available rules then exit
29
30 -d
31 List available rules with description then exit
32 If a color rule is given, only this rule is listed
33
34 -n
35 Invert colors
36
37 -g
38 Logarithmic scaling
39
40 -a
41 Logarithmic-absolute scaling
42
43 -c
44 Convert color rules from RGB values to color table
45 Option ’rgb_column’ with valid RGB values required
46
47 --help
48 Print usage summary
49
50 --verbose
51 Verbose module output
52
53 --quiet
54 Quiet module output
55
56 --ui
57 Force launching GUI dialog
58
59 Parameters:
60 map=name [required]
61 Name of vector map
62 Or data source for direct OGR access
63
64 layer=string
65 Layer number or name
66 Vector features can have category values in different layers. This
67 number determines which layer to use. When used with direct OGR ac‐
68 cess this is the layer name.
69 Default: 1
70
71 use=string [required]
72 Source values
73 Options: attr, cat, z
74 Default: cat
75 attr: read values from attribute table (requires <column> option)
76 cat: use category values
77 z: use z coordinate (3D points or centroids only)
78
79 column=name
80 Name of column containing numeric data
81 Required for use=attr
82
83 range=min,max
84 Manually set range (refers to ’column’ option)
85 Ignored when ’rules’ given
86
87 color=style
88 Name of color table
89 Options: aspect, aspectcolr, bcyr, bgyr, blues, byg, byr, celsius,
90 corine, curvature, differences, elevation, etopo2, evi, fahrenheit,
91 forest_cover, gdd, grass, greens, grey, grey.eq, grey.log, grey1.0,
92 grey255, gyr, haxby, inferno, kelvin, magma, ndvi, ndwi, nlcd, or‐
93 anges, plasma, population, population_dens, precipitation, precipi‐
94 tation_daily, precipitation_monthly, rainbow, ramp, random, reds,
95 roygbiv, rstcurv, ryb, ryg, sepia, slope, soilmoisture, srtm,
96 srtm_plus, terrain, viridis, water, wave
97 aspect: aspect oriented grey colors [range: map values]
98 aspectcolr: aspect oriented rainbow colors [range: 0 to 360]
99 bcyr: blue through cyan through yellow to red [range: map values]
100 bgyr: blue through green through yellow to red [range: map values]
101 blues: white to blue [range: map values]
102 byg: blue through yellow to green [range: map values]
103 byr: blue through yellow to red [range: map values]
104 celsius: blue to red for degree Celsius temperature [range: -80 to
105 80]
106 corine: EU Corine land cover colors [range: 111 to 995]
107 curvature: for terrain curvatures (from v.surf.rst and r.slope.as‐
108 pect) [range: map values]
109 differences: differences oriented colors [range: map values]
110 elevation: maps relative ranges of raster values to elevation
111 color ramp [range: map values]
112 etopo2: colors for ETOPO2 worldwide bathymetry/topography [range:
113 -11000 to 8850]
114 evi: enhanced vegetative index colors [range: -1 to 1]
115 fahrenheit: blue to red for Fahrenheit temperature [range: -112 to
116 176]
117 forest_cover: percentage of forest cover [range: 0 to 100]
118 gdd: accumulated growing degree days [range: 0 to 6000]
119 grass: GRASS GIS green (perceptually uniform) [range: map values]
120 greens: white to green [range: map values]
121 grey: grey scale [range: map values]
122 grey.eq: histogram-equalized grey scale [range: map values]
123 grey.log: histogram logarithmic transformed grey scale [range: map
124 values]
125 grey1.0: grey scale for raster values between 0.0-1.0 [range: 0 to
126 1]
127 grey255: grey scale for raster values between 0-255 [range: 0 to
128 255]
129 gyr: green through yellow to red [range: map values]
130 haxby: relative colors for bathymetry or topography [range: map
131 values]
132 inferno: perceptually uniform sequential color table inferno
133 [range: map values]
134 kelvin: blue to red for temperature in Kelvin scale [range: 193.15
135 to 353.15]
136 magma: perceptually uniform sequential color table magma [range:
137 map values]
138 ndvi: Normalized Difference Vegetation Index colors [range: -1 to
139 1]
140 ndwi: Normalized Difference Water Index colors [range: -200 to
141 200]
142 nlcd: US National Land Cover Dataset colors [range: 0 to 95]
143 oranges: white to orange [range: map values]
144 plasma: perceptually uniform sequential color table plasma [range:
145 map values]
146 population: color table covering human population classification
147 breaks [range: 0 to 2e+09]
148 population_dens: color table covering human population density
149 classification breaks [range: 0 to 1e+09]
150 precipitation: precipitation color table (0..2000mm) [range: 0 to
151 7000]
152 precipitation_daily: precipitation color table (0..1000mm) [range:
153 0 to 10000]
154 precipitation_monthly: precipitation color table (0..1000mm)
155 [range: 0 to 1000]
156 rainbow: rainbow color table [range: map values]
157 ramp: color ramp [range: map values]
158 random: random color table [range: map values]
159 reds: white to red [range: map values]
160 roygbiv: [range: map values]
161 rstcurv: terrain curvature (from r.resamp.rst) [range: map values]
162 ryb: red through yellow to blue [range: map values]
163 ryg: red through yellow to green [range: map values]
164 sepia: yellowish-brown through to white [range: map values]
165 slope: r.slope.aspect-type slope colors for raster values 0-90
166 [range: 0 to 90]
167 soilmoisture: soilmoisture color table (0.0-1.0) [range: 0 to 1]
168 srtm: color palette for Shuttle Radar Topography Mission elevation
169 [range: -11000 to 8850]
170 srtm_plus: color palette for Shuttle Radar Topography Mission ele‐
171 vation (with seafloor colors) [range: -11000 to 8850]
172 terrain: global elevation color table covering -11000 to +8850m
173 [range: -11000 to 8850]
174 viridis: perceptually uniform sequential color table viridis
175 [range: map values]
176 water: water depth [range: map values]
177 wave: color wave [range: map values]
178
179 raster=name
180 Raster map from which to copy color table
181
182 raster_3d=name
183 3D raster map from which to copy color table
184
185 rules=name
186 Path to rules file
187
188 rgb_column=name
189 Name of color column to populate RGB values
190 If not given writes color table
191
193 v.colors allows creating or modifying color table associated with a
194 vector map similarly to r.colors for raster maps.
195
196 Color rules are built from features category values (use=cat) or nu‐
197 meric data column (use=attr) defined by column option. For 3D vector
198 maps is allowed to define color rules based on points or centroids
199 z-coordinate (use=z). 3D vector lines are not supported.
200
201 The raster option allows user to specify a raster map from which to
202 copy the color table, similarly raster_3d option for 3D raster map.
203 Without use=attr and column options, raster values will be matched with
204 categories. Use these two options to transfer raster colors to vector
205 attributes.
206
207 The rules color table type will cause v.colors to read color table
208 specifications from given file and will build the color table accord‐
209 ingly. See r.colors manual page for details.
210
211 If the user specifies the -w flag, the current color table file for the
212 input map will not be overwritten. This means that the color table is
213 created only if the vector map does not already have a color table. If
214 this option is not specified, the color table will be created if one
215 does not exist, or modified if it does.
216
217 Alternatively the color rules can be stored in a string column
218 (rgb_column) by saving the RRR:GGG:BBB values suitable for use with
219 d.vect.
220
222 For vector maps with a large number of features it’s more convenient to
223 store color rules in an attribute column (given by rgb_column) rather
224 then in a color table file. Reading color tables with more then 1000
225 items is slow.
226
228 Define color table based on categories
229 Define color table wave based on categories from layer 1
230 v.colors map=soils_general layer=1 color=wave
231
232 Define color table based on attribute values
233 Define color table ryg based on values from attribute column AREA. At‐
234 tribute table is linked to layer 1.
235 v.to.db map=soils_general layer=1 option=area column=AREA
236 v.colors map=soils_general layer=1 color=wave use=attr column=AREA
237
238 Define color table stored as RGB values in attribute table
239 Write color values to the attribute table (column GRASSRGB) instead of
240 creating color table.
241 v.colors map=soils_general layer=1 color=wave use=attr column=AREA rgb_column=GRASSRGB
242 # See some GRASSRGB values:
243 v.db.select map=soils_general where="cat < 4"
244 cat|OBJECTID|AREA|PERIMETER|GSLNC250_|GSLNC250_I|GSL_NAME|GRASSRGB
245 1|1|0|164616.125|2|1|NC113|212:42:127
246 2|2|0|30785.529297|3|2|NC096|212:42:127
247 3|3|0|87572.882812|4|3|NC097|212:42:127
248
249 Convert RGB attribute values into color table
250 Convert existing RGB values to color table rules.
251 v.colors -c map=soils_general rgb_column=GRASSRGB
252 Note that in this case the vector map has a proper color table assigned
253 (check by v.colors.out) together with GRASSRGB attribute column. Also
254 note that color table is preferred over RGB values stored in attribute
255 table.
256
257 Transfer raster colors to vector
258 # create an example raster from census blocks (10m pixel resolution)
259 g.region vector=censusblk_swwake res=10 -ap
260 v.to.rast input=censusblk_swwake use=attr attribute_column=TOTAL_POP output=censusblk_swwake_total_pop
261 r.colors -e map=censusblk_swwake_total_pop color=blues
262 # transfer raster colors to vector attributes (raster values to attributes)
263 r.colors.out map=censusblk_swwake_total_pop rules=- | v.colors map=censusblk_swwake use=attr column=TOTAL_POP rules=-
264 # equivalent, but simpler
265 v.colors map=censusblk_swwake use=attr column=TOTAL_POP raster=censusblk_swwake_total_pop
266 # transfer raster colors to vector categories (raster values to categories)
267 v.colors map=censusblk_swwake raster=censusblk_swwake_total_pop
268
269 Remove existing color table
270 Existing color table can be removed by -r flag.
271 v.colors -r map=soils_general
272 Before removing color table you can store color rules to the file by
273 v.colors.out and later to assign by rules option.
274 v.colors.out map=soils_general rules=soils.colr
275 v.colors map=soils_general rules=soils.colr
276 To drop RGB column use v.db.dropcolumn.
277 v.db.dropcolumn map=soils_general column=GRASSRGB
278
280 d.vect, r.colors, r.colors.out, r3.colors, r3.colors.out, v.colors.out
281
282 See also wiki page Color tables (from GRASS User Wiki)
283
284 ColorBrewer is an online tool designed to help people select good color
285 schemes for maps and other graphics.
286
288 Martin Landa, OSGeoREL, Czech Technical University in Prague, Czech Re‐
289 public
290 Huidae Cho
291
293 Available at: v.colors source code (history)
294
295 Accessed: Mon Jun 20 16:46:56 2022
296
297 Main index | Vector index | Topics index | Keywords index | Graphical
298 index | Full index
299
300 © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
301
302
303
304GRASS 8.2.0 v.colors(1)