[GRASSLIST:515] e00 import, creating reclass from dig-cats file (was: creating legend file for vector map)

Moritz Lennert mlennert at club.worldonline.be
Wed Jun 25 04:39:51 EDT 2003


Hi Keith,
(cc to the grass-users list, so that other can profit from our discussions
;-) )

Keith J. Forbes said:
>
> Dear Moritz:
>
> Thanks for sticking with this.
>
> Ok. something is weird here and I think it has to do with the original
> import of the e00 file (source of the data). I copied the attached file to
> ecol, and then ran v.support.
>
> I checked with v.info, and the other r ones, as you suggested, and there
> are 547 cats not 43. Now, each of these cats which from the file created
> in dig_cats is basically a different ecotype. I would like each ecotype to
> appear as a unique color and in the legend.

GRASS texts can be a bit confusing in there use of the terms category and
attribute: the attribute or category NUMBER is stored in the dig_att file,
the LABELS (i.e. the descriptions) for the different attributes or
categories are stored in the dig_cats file.

So, when your file is imported, a dig_att file is created with
category/attribute numbers, that don't necessarily have to be unique.
Here's an example of the contents of such a file:

A 163027.7718230 151474.5355770          1
A 164207.9674190 172255.2677390          2
A 189804.7270340 238558.1220960          3
A 190347.9399790 238476.2118820          3

It is this file that is used for the definition of the categories in the
raster file. So if you have a dig_att file containing 547 different
category numbers, then v.to.rast will give you 547 different categories in
the resulting categories file.

m.in.e00 creates different dig_cats files for each seperate attribute it
finds in the e00 file. You correctly identified the one you're interested
in and copied it to ecol, but this concerns the labels or descriptions,
not the category numbers which are unique for each polygon.

> I tried fooling GRASS by
> creating a text file with columns as follows:
>
>
> (normal header info)
>
> 1:ecotype1
> 1:ecotype1
> 2:ecotype2
> 2:ecotype2
> 2:ecotype2
> 3:ecotype3
> 3:ecotype3
> and so on for all 547
>
> and then running v.support
>
> GRASS did not like this at all.
>

The numbers on the left should be unique and correspond to the numbers
used in the dig_att file, so it is normal that this doesn't work.

> So, I am going to try r.reclass on the raster file, and, after changing
> all values to zero, change all the values for the same ecotype to the same
> number (from 2-43). Then, I will run d.legend to see if it works.
>

You need to use the dig_cats file to create reclass rules in order to make
your category labels into category numbers. See
http://op.gfz-potsdam.de/GRASS-List/Archive/msg08631.html for two
different solutions to this. However, as far as I can see, only the second
(the one in the cited section of the mail) will work if your labels in the
dig_cats file are text (as is your cas). But I might be wrong.

I hope this will solve your problems.

Moritz




More information about the grass-user mailing list