[GRASS5] grass e00 format

cheg01 at attbi.com cheg01 at attbi.com
Tue Apr 22 20:33:04 EDT 2003


----- Original Message -----
From: "carlos cap" <ecograss at latinmail.com>
To: <grass5 at grass.itc.it>
Sent: Monday, April 21, 2003 3:48 PM
Subject: [GRASS5] grass e00 format

> Hello
>
> I have a file in e00 format, I import with m.in.e00 ok
> later I obtain file in carpet dig, dig_cats
> When I vectorize (d.vect) a map ok
> but when d.vect.what don't appears a valor 1,2,3,... and the category
1000,1200,1300, I need change a valor by the category but create a MDT of
place. It's a posible this change a lavel automatical withing to uze
r.reclass or v.reclass.
>
>
> thanks
>
I'm not sure, but this might help you:

The behavior of Grass 5.0 when importing .e00 area files has caused me some
problems the past. I always end up with thousands of areas with unique type
numbers assigned in dig_cats, even though many areas share the same text
label value. I have come up with an awk script and a command line that will
automatically generate reclass input files to create maps that use the text
label to identify type instead of the arbitrary number assigned by grass at
import time.

First cd to the relevant dig_cats directory.
If your vector file name is $MAP, the command line to create the reclass
file is:

              sort -k 2 -t : $MAP | awk -f reclass.awk > reclass


To fix the vector file, the commands are:

cat reclass | v.reclass -d type=area input=$MAP output=`echo $MAP`_reclass;
v.support `echo $MAP`_reclass;

The same basic process works for raster files if you do it the "cats"
directory and use "r.reclass input=$MAP output=`echo MAP`_reclass" instead
of v.reclass.

The reclass.awk file is:

##########################################
#   reclass.awk
#   input must be sorted by cat label before running this!
##########################################

 BEGIN { FS=":" ; ind=0 }

/^[#%A-Za-z0]../ { next }

/^[1-9]../ {
if (ind==0) {
   test = $2
   ind++
}

if ($2 != test) ind++
test=$2
printf("%d=%d %s\n",$1,ind,$2)
}
##########################################




More information about the grass-dev mailing list