[GRASS5] d.vect.leg

Hallo developers,
before I rewrite d.legend so it is able to work with vector maps too (and I'm
still not sure, if I ever get it), i wrote a script, based on d.vect.thematic,
which should solve as d.vect.leg. It does the same, as d.rast.leg does too. The
difference from d.vect.thematic is, that this script works with GRASSRGB column
from the database.

Anyone for testing?

Screenshot at http://les-ejk.cz/.../d.vect.leg.png

Jáchym
--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

(attachments)

d.vect.leg (3.83 KB)

Hi,

On Út, 17 kvì 2005, Jachym Cepicky wrote:

Anyone for testing?

I have tested it slightly, there is a small patch...

Martin

--
Martin Landa <landa@gama.fsv.cvut.cz> * http://gama.fsv.cvut.cz/~landa *
CTU Prague, Faculty of Civil Engineering, Czech Republic

(attachments)

d.vect.leg.patch (336 Bytes)

here I post new version with patch from Martin.

We have one problem:

if one uses "for line in `echo "SELECT...."|db.select`

and if db.select returns more words from the dabase, each string is handeld as
separate variable $line

nlines=0;
new_cat=0;

# searching for categories
for line in `echo "SELECT $GIS_OPT_column,GRASSRGB FROM $table ORDER BY grassrgb"|db.select -c fs=";"`;
do
    eval `echo "$line"|sed -e s/^/cat=\"/|sed -e s/\;/\"\;\ color=\"/|sed -e s/$/\"/`

    # is this new category?
    for index in `seq 1 $nlines`; do
        cur_cat=${cat_vals[$index]}
        #echo "#$cat# #$cur_cat#"
        if [ "$cur_cat" == "$cat" ]; then
            new_cat=1;
        fi
    done

    # if it is new category, add to arrays cat_vals and cat_clrs
    if [ "$new_cat" == "0" ]; then
        index=`expr $index + 1`;
        cat_vals[$index]="$cat";
        cat_clrs[$index]="$color";
        nlines=`expr $nlines + 1`;
        new_cat=0;
    fi
    #echo $nlines # if you use 'echo "SELECT ..."|while read line' here it is OK
done
#echo $nlines # but here it gots value from line no 125

we tryed to implement something like

echo "SELECT $GIS_OPT_column...."|db.execute| while read line; do

...

done

hoewer the $nlines variable gets its original value (=0) :frowning:

any idea ?

Jachym

On Tue, May 17, 2005 at 08:09:24AM -0700, Michael Barton wrote:

tatus: RO
Content-Length: 828
Lines: 35

I'll take a look at it.

On 5/17/05 2:50 AM, "Jachym Cepicky" <jachym.cepicky@centrum.cz> wrote:

> Hallo developers,
> before I rewrite d.legend so it is able to work with vector maps too (and I'm
> still not sure, if I ever get it), i wrote a script, based on d.vect.thematic,
> which should solve as d.vect.leg. It does the same, as d.rast.leg does too.
> The
> difference from d.vect.thematic is, that this script works with GRASSRGB
> column
> from the database.
>
> Anyone for testing?
>
> Screenshot at http://les-ejk.cz/.../d.vect.leg.png
>
> Jáchym

____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

(attachments)

d.vect.leg (4.07 KB)