reclassification with v.reclass

Rick Gagne rghydro at
Wed Apr 12 06:17:18 EDT 2000

On Tue, 11 Apr 2000 18:27:41 +0200, Antonio Rodr¡guez wrote:

>Hi Rick,
>Well, I couldn't yet solve this problem. I've tried to modify some of
>the dig* using some awk comands in order to change the order of the
>columns within the file. But I didn't get any acceptable result.

Hi Antonio,

Frustrating, isn't it?

The problem with v.reclass seems to stem from an input field for old=new 
reclass rule that cannot be more than 7 characters long (i.e. 11250=16 is 
eight characters long and will cause v.reclass to return an error). Someone 
needs to look at correcting this perhaps.

Here is what I tried over the weekend, with relatively good success (but 
much effort studying file contents, and with the help of an extended editor 
that runs on OS/2, but for which I have not yet found a UNIX equivalent ).

I imported the vector.e00 file using Then I loaded into an editor 
and carefully studied the content of the new att.* file created, all new cat.* 
files created by, and the original vector.e00 file. I found the 

1.  That the att.* file listed the area identification numbers as attributes (as 
you did).

2. That often times (but not always), a cat.* file contained the site 
identification in one column and classes that  I needed (i.e. clay, sandy soil, 
till, etc.) in another column.

3.  There appears to be a problem with, where it does not always 
import all classes. If that is the case, you can get them directly from the e00 
file (with a little study of the file format . . . you'll probably find what you're 
looking for at the bottom of the file). If I could only find the classes I needed 
in the e00 file, then I extracted them (and their definitions) from the file by 
cutting and pasting in the editor.

This is what I do.

Run on what produces (but do not bother to change any 
fo the file temp.class_type file names in the cat directory).

Then I generated my own att.* file with the OS/2 editor, which allows cutting, 
copying and pasting data in blocks inside the text or in columns, as I perfer 
(i.e. it is not limited to blocking by line only). I copy the column of data I want 
(either numbers, or descriptions) from the cat.* file (or modified part from the 
e00 file) into the att.* file, and place it following the last column (i.e. site 
identifiers) in the att.* file.

Then with search and replace, I change descriptors (i.e. clay, silt, sand) to 
numeric class values, and by cutting out the column of site identifiers, I 
obtain a new att.* file. I then play around with the editor's search and replace 
to properly format the file (i.e. proper spaces and delimiters).

Finally, run again, but this time with matching names in the dig.*, 
att.* and cat.* directories and . . . Presto! . . . I find that GRASS is happy with 
the new att.* file.

As indicated, I may have an unfair advantage in this process by also 
running OS/2 on my machines. However, the effect of copying and moving 
"columns" may be simulated by importing the appropriate att.* and cat.* 
files into a spreadsheet program (although some spreadsheed will limit the 
number of rows you can import . . . I had one file with over 25000 areas that 
was just too large to import into any spreadsheet). Manipulate the columns 
inside the spreadsheed, then export the rearranged file from the 
spreadsheet as a comma or colunm delimited file. Then use an editor to 
properly format the outcome.

In closing, I hope you don't mind, but I have copied this message to the 
GRASS mail list in the hope that someone else out there may either benefit 
from this stop-gap solution, or provide a better solution.

Best of luck and if you hear of any other solutions, please let me know.



RG Hydro-Environmental Ltd.
WaterWatch ..... independent groundwater research

Richard Gagne, P.Geo., President
PO Box 25099
Halifax, NS  Canada   B3M 4H4

e-mail: rghydro at
phone: (902) 457-7010
fax: (902) 457-3934

More information about the grass-user mailing list