[GRASSLIST:1856] Re: e00 attributes

Michel Wurtz mjwurtz at wanadoo.fr
Thu Nov 20 18:09:05 EST 2003


Christopher Fonnesbeck wrote:
> I am having trouble dealing with vector attributes from imported e00 
> files. I understand that each attribute from an e00 import has its own 
> file in $LOCATION/dig_cats.  What I don't understand is what to do with 
> them after that. The Open Source GIS book does not have much to say 
> about this, other than copying the *entire* map for each attribute 
> (which is very inefficient when there are lots of attributes). Surely 
> there should be a table somewhere with all the attributes by which 
> queries can be run, no? Can I not at least generate a postrgesql table 
> from all of these files? How else are they supposed to be used? I 
> welcome any clarification or hints about this.

Well, m.in.e00 does not create a database (still a "project"), because it
was written before Grass5.1...  So you have to do some "reclass" of the
vector file to have someting more usable.  The usual answer follows :

---------------- extracted from an old mail of mine ----------------
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