Note: This document is for an older version of GRASS GIS that will be discontinued soon. You should upgrade, and read the current manual page.
How it works: it creates a dummy raster map with the same data range as the vector's column then runs r.colors for that temporary map. It then uses r.what.colors for each value found by v.db.select and uploads it a new column in the vector map's attribute database.
It is planned that this script will be replaced with a C display module which renders thematic vector maps directly instead requiring the overhead of saving the colors into the DB.
If the target column name given by the rgb_column option does not exist, it will be created. The default name is "GRASSRGB".
# Spearfish dataset g.region -d v.random out=rand5k_elev n=5000 v.db.addtable map=rand5k_elev column='elevation double precision' v.what.rast vector=rand5k_elev raster=elevation.10m column=elevation v.colors map=rand5k_elev column=elevation color=bcyr # display colorized points map d.mon x0 d.vect -a rand5k_elev
Colorizing the roads map in Spearfish:
g.copy vector=roads,myroads echo "1 red 2 yellow 3 orange 4 black 5 grey" > colors.txt v.colors myroads column=cat rules=colors.txt # display colorized roads map d.mon x0 d.vect -a myroads
Colorizing a TIN (polygons) generated by v.delaunay:
# new columns for x,y,z of centroids v.db.addtable map=tin \ columns="east double precision, north double precision, height double precision, GRASSRGB varchar(11)" # transfer geometry for colorizing (we need the centroid height) v.to.db tin option=coor columns="east,north,height" v.db.select tin v.colors tin column=height rgb_column=GRASSRGB color=rainbow # display colorized triangles d.mon x0 d.vect -a tin
Available at: v.colors2 source code (history)
Latest change: Monday Jun 28 07:54:09 2021 in commit: 1cfc0af029a35a5d6c7dae5ca7204d0eb85dbc55
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
© 2003-2023 GRASS Development Team, GRASS GIS 7.8.9dev Reference Manual