[GRASSLIST:448] Re: creating legend file for vector map
Moritz Lennert
mlennert at club.worldonline.be
Fri Jun 20 12:08:45 EDT 2003
Keith J. Forbes said:
> Hi. I have imported using m.in.e00 e00 vector maps, and all the associated
> categories have been imported and are stored in the dig_cats directory. I
> would like to create a legend file (preferably have GRASS do this for me)
> so
> that each category can de displayed with a different color and an
> accompanying legend.
>
> The only info I have found so far is that I would have to create this bt
> hand
> using the category files, which seems to be quite cumbersome.
>
> I hope there is another way to do this, and would appreciate any help.
> Thanks
> in advance for your indulgence of a GRASS newbie.
No, you will have to do it "by hand", but this could mean via a script.
As an example:
Using a vector file with 11 categories, numbered 1-11 according to the
importance of a specific phenomenon (1 being the most important and 11 the
least important), you could copy the dig_cats file corresponding to this
map into a working directory, there (within that copy) erase all the lines
before the first category, and use a script such as
awk 'BEGIN{FS=":"} {print $1, int($1*255/12), int($1*255/12),
int($1*255/12)}' ReworkedDig_CatsFile > legend.file
to create a grey scale legend.
If you play around with the "int($1*255/12)" parts, you can create
different color scales.
However, if you do not want scales but a specific color for each category,
then you will have to do this by hand...
Moritz
More information about the grass-user
mailing list