[GRASS-user] v.colors: new wiki addon script

Hamish hamish_b at yahoo.com
Mon Feb 18 03:32:16 EST 2008


Hi,

I have added a new script to the wiki addons page: v.colors.

  http://grass.gdf-hannover.de/wiki/GRASS_AddOns
  http://trac.osgeo.org/grass/browser/grass-addons/vector

It is just like r.colors but for vector maps.
You give it a vector map and data column, together with color rules like
you would for a raster. It creates a new column in the database with
R:G:B values suitable for use with 'd.vect -a'.

Hopefully it helps supplement the ongoing thematic mapping efforts.
It is mildly tested so far and pretty simple; seems to be ~75% error
checking code.

How it works: it creates a dummy raster map with the same data range as
the vector's column then runs r.colors on that. Then it uses
r.what.colors for each value found by v.db.select and uploads it to the
DB. Better would be a C module which rendered directly instead of saving
the colors in the DB.

See also r.cpt2grass in the wiki addons for converting GMT color tables
to GRASS's color table format. (for use with '{r|v}.colors rules=')


enjoy,
Hamish


More information about the grass-user mailing list