GRASS logo

NAME

v.colors - Creates/modifies the color table associated with a vector map.

KEYWORDS

vector, color table

SYNOPSIS

v.colors
v.colors help
v.colors [-rwlngac] map=name layer=string [column=name] [range=min,max] [color=style] [raster=name] [volume=name] [rules=name] [rgb_column=name] [--verbose] [--quiet]

Flags:

-r
Remove existing color table
-w
Only write new color table if one doesn't already exist
-l
List available rules then exit
-n
Invert colors
-g
Logarithmic scaling
-a
Logarithmic-absolute scaling
-c
Convert color rules from RGB values to color table
Option 'rgb_column' with valid RGB values required
--verbose
Verbose module output
--quiet
Quiet module output

Parameters:

map=name [required]
Name of vector map
Or data source for direct OGR access
layer=string [required]
Layer number or name
A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
Default: 1
column=name
Name of column containing numeric data
If not given categories are used
range=min,max
Manually set range (refers to 'column' option)
Ignored when 'rules' given
color=style
Name of color table
Options: aspect, aspectcolr, bcyr, bgyr, byg, byr, celsius, corine, curvature, differences, elevation, etopo2, evi, gdd, grey, grey.eq, grey.log, grey1.0, grey255, gyr, haxby, ndvi, population, population_dens, precipitation, precipitation_monthly, rainbow, ramp, random, rstcurv, ryb, ryg, sepia, slope, srtm, terrain, wave
aspect: aspect oriented grey colors
aspectcolr: aspect oriented rainbow colors
bcyr: blue through cyan through yellow to red
bgyr: blue through green through yellow to red
byg: blue through yellow to green
byr: blue through yellow to red
celsius: blue to red for degree Celsius temperature
corine: EU Corine land cover colors
curvature: for terrain curvatures (from v.surf.rst and r.slope.aspect)
differences: differences oriented colors
elevation: maps relative ranges of raster values to elevation color ramp
etopo2: colors for ETOPO2 worldwide bathymetry/topography
evi: enhanced vegetative index colors
gdd: accumulated growing degree days
grey: grey scale
grey.eq: histogram-equalized grey scale
grey.log: histogram logarithmic transformed grey scale
grey1.0: grey scale for raster values between 0.0-1.0
grey255: grey scale for raster values between 0-255
gyr: green through yellow to red
haxby: relative colors for bathymetry or topography
ndvi: Normalized Difference Vegetation Index colors
population: color table covering human population classification breaks
population_dens: color table covering human population density classification breaks
precipitation: precipitation color table (0..2000mm)
precipitation_monthly: precipitation color table (0..1000mm)
rainbow: rainbow color table
ramp: color ramp
random: random color table
rstcurv: terrain curvature (from r.resamp.rst)
ryb: red through yellow to blue
ryg: red through yellow to green
sepia: yellowish-brown through to white
slope: r.slope.aspect-type slope colors for raster values 0-90
srtm: color palette for Shuttle Radar Topography Mission elevation
terrain: global elevation color table covering -11000 to +8850m
wave: color wave
raster=name
Raster map from which to copy color table
volume=name
3D raster map from which to copy color table
rules=name
Path to rules file
"-" to read rules from stdin
rgb_column=name
Name of color column to populate RGB values
If not given writes color table

DESCRIPTION

v.colors allows the user to create and/or modify the color table for a vector map. The vector map (specified on the command line by map) must exist in the user's current mapset search path.

As input a vector map with a numeric data column is required which is used to apply the color rules. The color values are stored in a string column (default name "GRASSRGB", varchar(11)) by saving the RRR:GGG:BBB values suitable for use with 'd.vect -a'. If this RGB column is not found in the attribute table, it is automatically created.

The rast option allows user to specify a raster map name from which to copy the color map.

The volume option allows user to specify a volume (3D raster) map name from which to copy the color map.

If the user specifies the -w flag, the current color table file for the input map will not be overwritten. This means that the color table is created only if the map does not already have a color table. If this option is not specified, the color table will be created if one does not exist, or modified if it does.

In general, tables which associate colors with percentages (aspect, bcyr, byg, byr, elevation, grey, gyr, rainbow, ramp, ryb, ryg and wave) can be applied to any data, while those which use absolute values (aspectcolr, curvature, etopo2, evi, ndvi, population, slope, srtm, and terrain) only make sense for data with certain ranges. One can get a rough idea of the applicability of a colour table by reading the corresponding rules file ($GISBASE/etc/colors/<name>). For example the ryg rule is defined as:

0% red
50% yellow
100% green

The rules color table type will cause r.colors to read color table specifications from standard input and will build the color table accordingly.

For details see r.colors manual page.

EXAMPLES

Define color table wave based on categories from layer 1
v.colors map=soils_general layer=1 color=wave
Define color table ryg based on values from attribute column AREA. Attribute table is linked to layer 1.
v.to.db map=soils_general layer=1 option=area column=AREA
v.colors map=soils_general layer=1 color=wave column=AREA
Write color values to the attribute table (column GRASSRGB) instead of creating color table.
v.colors map=soils_general layer=1 color=wave column=AREA rgb_column=GRASSRGB

# See some GRASSRGB values:
v.db.select map=soils_general | head -n 4
cat|OBJECTID|AREA|PERIMETER|GSLNC250_|GSLNC250_I|GSL_NAME|GRASSRGB
1|1|0|164616.125|2|1|NC113|212:42:127
2|2|0|30785.529297|3|2|NC096|212:42:127
3|3|0|87572.882812|4|3|NC097|212:42:127
Convert existing RGB values to color table rules.
v.colors -c map=soils_general rgb_column=GRASSRGB
Note that in this case the vector map has a proper color table assigned (check by v.colors.out) together with GRASSRGB attribute column. Also note that color table is prefered over RGB values stored in attribute table.

Existing color table can be removed by -r flag.

v.colors -r map=soils_general
Before removing color table you can store color rules to the file by v.colors.out and later to assign by rules option.
v.colors.out map=soils_general > soils.colr
v.colors map=soils_general rules=soils.colr
To drop RGB column use v.db.dropcolumn.
v.db.dropcolumn map=soils_general column=GRASSRGB

SEE ALSO

d.vect, v.colors.out, r.colors, r.colors.out, r3.colors, r3.colors.out,

See also wiki page Color tables (from GRASS User Wiki)

ColorBrewer is an online tool designed to help people select good color schemes for maps and other graphics.

AUTHORS

Martin Landa, Czech Technical University in Prague, Czech Republic

Last changed: $Date: 2011-11-14 02:46:47 -0800 (Mon, 14 Nov 2011) $


Main index - Vector index - Full index

© 2003-2012 GRASS Development Team