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

Moritz Lennert mlennert at club.worldonline.be
Thu Jun 26 04:08:11 EDT 2003


Keith J. Forbes said:
> On Wednesday 25 June 2003 09:39, Moritz Lennert wrote:
>> 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
>
> Moritz: Hi again.
> Tried the second method as you suggested from
> http://op.gfz-potsdam.de/GRASS-List/Archive/msg08631.html
> worked like a charm.
>
> One question though. This process with the awk script and then using the
> file
> with a unique identifier for each label as follows as the basis for
> v.reclass
> and then v.support, would this be a much faster equivalent of a manual
> interactive v.reclass or r.reclass, changing the value to the same unique
> number for each label, and then running v.support?
> --------
> 1=1 label1
> 2=1 label1
> 3=2 label2
> 4=2 label2
> 5=2 label2
> to
> 547 (in this case)
>
>
> and so on for all the "categories" created by GRASS during m.in.e00 import
> of
> e00 file in a particular label file (in dig_cats directory)
>

I'm not sure I understand your question correctly. To me it seems obvious
that typing one command line with the awk script would be faster than
typing every single reclass rule myself...


> Decided to get the GRASS book by Mitasova et al.!! My questions may be
> less
> easy in the future. ;)

No, you'll start answering those of the others ;-)

Moritz




More information about the grass-user mailing list