[GRASS-dev] [grass-code R] v.colors wish
hamish_nospam at yahoo.com
Thu May 3 08:36:31 CEST 2007
[cc from the wish tracker]
> code R item #382, was opened at 2007-04-25 22:35
> Submitted By: Markus Neteler (markusn)
> Summary: v.colors wish
> A v.colors module (script?) is desired which helps to easily colorize
> vector maps.
> v.colors vectormap column=name color=rulesfile
> - column defines the column to use for colorization
> - color defines a file to the list of attribute-color matches
> The principal steps will be:
> 1. v.db.addcol vectormap col="GRASSRGB varchar(11)"
> 2. read color definition in the style
> attribute1 color1
> attribute2 color2
> - attributeX be existing attribute in specified column
> - colorX be color name (from X11 color list?) or RGB pattern
> 3. if needed, translate color names to RRR:GGG:BBB values
> 4. update attribute table column GRASSRGB
> loop over all lines in rulesfile, doing
> v.db.update vectormap col=GRASSRGB val="RRR:GGG:BBB"
> Maybe rather easy to do, some scripting...
Date: 2007-05-03 18:31
> A v.colors module (script?)
It is hard to do (efficiently) inside a script alone, as you
need to do some math to interpolate between the rule values for
each data point.
Suggestion: r.what.colors could be expanded to include a
colors=/rules= option to query the color for some value= based
on a predefined rules file instead of a raster map? Then you feed
all the values to be queried to r.what.colors via stdin, and get
a nice list of RRR:GGG:BBB to give to v.db.update.
Instead of v.db.update, write the SQL update statements to a $TMP
file (with ";" at each EOL) then use a single call to db.execute input=,
as this will be much much faster. (see v.in.garmin)
ps- this would be really cool for "snail trail" plots
for a geolocated time series of vector point data.
(I have a matlab[/octave] script somewhere that does this
interpolation already, for this same purpose)
More information about the grass-dev