[GRASSLIST:4983] Re: Areas in dig_att

Radim Blazek blazek at itc.it
Mon Nov 18 04:18:32 EST 2002

On Saturday 16 November 2002 02:27 pm, Alexandra Zamparas wrote:
> > > Issue 1: How do I get the areas of the subbasins into the
> > > attribute table?
> >
> > You don't.  But maybe you can turn them into a category file
> > (dig_att/<name>).  The format is documented in the programming manual,
> > but mostly is just lines of "<category number> : <some text>".
> So, I would have to make a small script that extracts the values from
> the v.report result and writes them into a file <foo> under dig_att?

If you get ODBC working, you can read areas to attribute table in this way:
db.connect driver=odbc database=
v.to.db map= type=area option=cat table= key=id  # insert new rows for cats
v.to.db map= type=area option=area units=k table= key=id col1=  # load areas

If you don't want to use ODBC, you can get text report from v.to.db in
format more suitable for scripts than from v.report with '-p' flag.

(Note that there was a bug for line lengths in v.report, fixed 9 Oct 2002)

> >If you want each polygon/line/point to have a unique
> > reference number, than you must give it a unique number.
> I 'm not sure how to do that. Do I reclass my map manually and where
> it says 0, 2, 4, 6..I put 1, 2, 3, 4 ? Not very practical when you
> have like 245 or more subbasins. However, in the final end I need a
> file with unique numbers for each basin and area for it and other
> things.

If you don't have other attributes linked by your category numbers yet and
you want just 1,2,3 instead of 2,4,6 (0 is not valid category), you can
remove dig_att file, run v.support and v.alabel -i to get new cats.


More information about the grass-user mailing list