[GRASSLIST:5318] Re: GRASSRGB size, datatype and use

Moritz Lennert mlennert at club.worldonline.be
Wed Jan 12 09:10:08 EST 2005


On Tue, January 11, 2005 18:38, DrakeGis said:
> Hi,
>   Thanks for the information about "d.vect.area" that now is "d.vect -a".
> I still have a couple of questions. I would like to know what datatype
> should be the GRASSRGB column. I'm used text, but I receive a warning
> concerning to the length of the field, should it be varchar(11) ? How
> can I specify that using db.execute ? is correct to use:
>
> echo "ALTER TABLE table_t ADD COLUMN grassrgb text(11)" | db.execute

I don't know. Have you tried ;-)

Radim ?

Depending on the database format you use (dbf, postgresql, etc) You could try
with a database access program such as openoffice (via data source) or
pgaccess to do the job.

>
>  I also, would like to be able to use some command like this:
>
> echo "UPDATE table_t SET grassrgb='v1:v2:v3' WHERE cat=xxx "|db.execute
>
>   Where v1, v2, v3 and xxx are values that I can vary systematically or be
> the result of a calculation... for example, set the level of gray of a
> category accoding to the number of categories [the number is obtained by
> COUNT() and the color could be determined by doing something like CAT *
> 255 / COUNT() ] Is there any way to write such things in the echo part
> of db.execute or the only way id through a script ?

I think you might be better off with a script.

> Besides there is
> another problem, when I use 'v1:v2:v3' the "variables" v1, v2, and v3
> are taken as text, whereas if I try v1:v2:v3 there is a SQL problem with
> the character : ?

Are you talking about the actual caracters v1, v2, v3 which _are_ text, or are
you speaking of them as numbers ? If you have defined vX as being a number
(via export v1=1) then you might have to use $v1 instead of v1.

>    Futher more is it possible to use a file to specify the grassrgb values
> when I use d.vect -a  ????

I don't think so. But again, by using openoffice or something similar, it
would not be that different from writing into a file...

Moritz




More information about the grass-user mailing list