[GRASS5] How-to: labelling vectors with more than one category

Michael Ash mash at econs.umass.edu
Tue Oct 8 17:32:41 EDT 2002


Following the directions on page 124 of Neteler and
Mitasova's excellent Open Source GIS: A GRASS GIS Approach,
I was nonetheless having trouble managing more than one
category in vector files.

The difficulty appears to be that g.copy was overwriting the
category file in the dig_cats directory as well as creating
the correct geometry in the other dig* directories.

One solution is to preserve the desired file in dig_cats
directory by temporarily renaming it.

Basic strategy
(1) m.in.e00 the import file (with the v.support option)
(2) Rename the desired category file in dig_cats to a temporary name
(3) g.copy the vector file to a new vector file has the same name as the category file
(4) Rename the temporary file in dig_cats back to the category file

For example, I am importing .e00 (ESRI export format) files
for U.S. Census geography, e.g., county, census tract, etc.,
into Grass 5.0 vector files with m.in.e00.  These files have
more than one category, for example, county number, county
name, state number, and the default category is not of
general interest.  For example, to label the counties of
Massachusetts with their names:

> m.in.e00 -s /home/downloads/co25_d00.e00
> mv /home/grassdata/massachusetts/PERMANENT/dig_cats/co25_d00.name /home/grassdata/massachusetts/PERMANENT/dig_cats/temporary
> gcopy vect=co25_d00,co25_d00.name
> mv /home/grassdata/massachusetts/PERMANENT/dig_cats/temporary /home/grassdata/massachusetts/PERMANENT/dig_cats/co25_d00.name

Now, the following two commands will display the boundaries
and the county names respectively.

> d.vect co25_d00.name
> d.vect.labels co25_d00.name

I hope that this is helpful, and that more experienced GRASS
users will comment if I've made errors or if there is a more
efficient way to achieve the same end.

Best regards,

Michael Ash




More information about the grass-dev mailing list