[GRASS-dev] [grass-code R][382] v.colors wish
Hamish
hamish_nospam at yahoo.com
Thu May 3 02:36:31 EDT 2007
[cc from the wish tracker]
http://wald.intevation.org/tracker/?func=detail&atid=188&aid=382&group_id=21
> 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
>
> where
> - 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
> ...
>
> with
> - 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"
> where="column=attributeX"
>
> Maybe rather easy to do, some scripting...
Date: 2007-05-03 18:31
Sender: Hamish
> 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)
Hamish
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
mailing list