[GRASSLIST:539] creating reclass from dig_cats file
Michel Wurtz
mjwurtz at wanadoo.fr
Thu Jun 26 16:00:51 EDT 2003
I don't have an access to the CVS tree due to a new provider, but I think
the following text must be put on the m.in.e00 manpage... (Markus, do you
hear me ? ;-)
It is often desirable to use one of the original object attributes as value
in the dig_att file (ex: elevation for contour lines, so you can made a dem,
etc.)
As a reminder : If ther is only one attribute (other than the standard ESRI
attributes for lines or areas), ther is only one dig_cats file created, and
its name is like the dig file name. If there is many attributes, there is
as many dig_cats files, named <vector_file_name>.<attribute_name>. In this case
the first thing to do is to go in the dig_cats directory and set a symbolic
link to the dig_cats file you want as the new dig_att values.
After that, you need only a two line command to change the att values. The
best is to take an example :
dig file name is brucom,
dig_att/brucom looks like :
# 48 categories
brucom
0.00 0.00 0.00 0.00
1:67482
2:67492
3:67354
4:67240
etc.
What you have to type :
export LOCATION=<your mpaset location>
sed -e '1,4d' -e 's/:/ = /' $LOCATION/dig_cats/brucom | v.reclass input=brucom
output=brucom1 type=area
v.support brucom1
The first line was added since $LOCATION is no longer set at grass startup...
The second one do the job : sed convert the dig_att file in a form usable by
v.reclass. You have to change
- the file names and the location (obviously)
- the type=area in type=line if you have lines instead of areas
The third line is mandatory for some other programs to work (v.digit, d.what.vect,
etc.)
To test the result, you can try
d.vect brucom
d.vect brucom1
d.what.vect
pointing on the map you should see something like :
Buttons
Left: what's here
Right: quit
987993.15898251(E) 1105829.10174881(N)
brucom1 in PERMANENT Area - Category 67212
Size - Sq Meters: 7287843.886 Hectares: 728.784
Acres: 1800.822 Sq Miles: 2.8138
brucom in PERMANENT Area - Category 37 67212
Size - Sq Meters: 7287843.886 Hectares: 728.784
Acres: 1800.822 Sq Miles: 2.8138
984231.52146264(E) 1107780.62798092(N)
brucom1 in PERMANENT Area - Category 67554
Size - Sq Meters: 7487888.438 Hectares: 748.789
Acres: 1850.253 Sq Miles: 2.8910
brucom in PERMANENT Area - Category 33 67554
Size - Sq Meters: 7487888.438 Hectares: 748.789
Acres: 1850.253 Sq Miles: 2.8910
You can see that the new file reflects what you wanted...
--
Michel Wurtz - Auzeville-Tolosane
More information about the grass-user
mailing list