[GRASSLIST:6359] Re: convert vector to raster

Hamish hamish_nospam at yahoo.com
Thu Apr 7 04:32:22 EDT 2005

> 1. assign a colortable to a vector layer, based on a given column of 
> attributes (something like r.colors for rasters)
> 2. preserve the rasters colortable after v.to.rast in the resulting
> vector  layer (having RGB codes stored in GRASSRGB column)

> Has anybody got an idea how to achieve this fairly easily so it could
> be  used for a daily work? Or would it require new functionality in
> Grass?

You would have to write something that created a GRASSRGB column and
populated it with formatted output from the raster's colr/ file.

To do it in a shell script, you would probably have to use g.findfile,
g.tempfile, and some db code stolen from the v.in.garmin script as well
as the usual unix tools. Shouldn't be *too* bad.

Or do it properly in the C code for r.to.vect / v.to.rast if you can.

The other direction is even easier as you can pipe directly to r.colors.


More information about the grass-user mailing list