[GRASSLIST:4952] Areas in dig_att

Hello!
Just wanted to start by thanking the people who have been answering
my questions every time, all suggestions have been very helpful. Now,
I'm looking at the dig_att file of my subbasins map and I can see the
coordinates (of the area centroid?), if it is an arc or line and the
cat.number.

Issue 1: How do I get the areas of the subbasins into the
attribute table?

Issue 2: Why do the categories appear as even numbers? Isn't the
category number supposed to be the unique-id?

Issue 3: Is it right that some category numbers appear more than
once?

For the purpose of testing your patience :), I'm copying the file
below.

Thanks in advance!

Warm regards,
Alexandra

A 594840.0000000 4924335.000000 2
A 595785.0000000 4924965.000000 4
A 597360.0000000 4923975.000000 26
A 598980.0000000 4924455.000000 28
A 600990.0000000 4925175.000000 30
A 601995.0000000 4925175.000000 48
A 602700.0000000 4924425.000000 80
A 605310.0000000 4924245.000000 106
A 601335.0000000 4924635.000000 50
A 600675.0000000 4924965.000000 32
A 600735.0000000 4924965.000000 46
A 599100.0000000 4923345.000000 32
A 600765.0000000 4924935.000000 46
A 600360.0000000 4923945.000000 46
A 601725.0000000 4924725.000000 50
A 594795.0000000 4922145.000000 6
A 595845.0000000 4924335.000000 6
A 596130.0000000 4921035.000000 20
A 604515.0000000 4923495.000000 104
A 600660.0000000 4923225.000000 52
A 601275.0000000 4924065.000000 62
A 601995.0000000 4922715.000000 62
A 606765.0000000 4923135.000000 108
A 605310.0000000 4922625.000000 100
A 603225.0000000 4923375.000000 82
A 604095.0000000 4922925.000000 86
A 602925.0000000 4921845.000000 84
A 603315.0000000 4923345.000000 86
A 603345.0000000 4923345.000000 82
A 600450.0000000 4922865.000000 54
A 600855.0000000 4922235.000000 60
A 599010.0000000 4922415.000000 56
A 599745.0000000 4921035.000000 58
A 600315.0000000 4922985.000000 58
A 604065.0000000 4922535.000000 88
A 603240.0000000 4920765.000000 102
A 601335.0000000 4922595.000000 52
A 603915.0000000 4922595.000000 102
A 604665.0000000 4922025.000000 90
A 601815.0000000 4922145.000000 64
A 602160.0000000 4920135.000000 66
A 601785.0000000 4922115.000000 64
A 596910.0000000 4920675.000000 34
A 598155.0000000 4922085.000000 36
A 601755.0000000 4922085.000000 64
A 598125.0000000 4921695.000000 36
A 600315.0000000 4919535.000000 64
A 605355.0000000 4921215.000000 94
A 603690.0000000 4919655.000000 92
A 604665.0000000 4921755.000000 94
A 604695.0000000 4921725.000000 94
A 604605.0000000 4921665.000000 90
A 604575.0000000 4921635.000000 90
A 596865.0000000 4921425.000000 32
A 596835.0000000 4921395.000000 32
A 597825.0000000 4920135.000000 38
A 606225.0000000 4920765.000000 96
A 598695.0000000 4920855.000000 44
A 598185.0000000 4921305.000000 44
A 594060.0000000 4920645.000000 8
A 594990.0000000 4920615.000000 14
A 594555.0000000 4920945.000000 14
A 605280.0000000 4919865.000000 98
A 594705.0000000 4918515.000000 16
A 595200.0000000 4919415.000000 18
A 606825.0000000 4919565.000000 110
A 598005.0000000 4917705.000000 42
A 597195.0000000 4919805.000000 40
A 601725.0000000 4919145.000000 68
A 602325.0000000 4920015.000000 78
A 602520.0000000 4919415.000000 78
A 598065.0000000 4919955.000000 40
A 604920.0000000 4918845.000000 112
A 599190.0000000 4916835.000000 70
A 602520.0000000 4918545.000000 76
A 596550.0000000 4917615.000000 24
A 605820.0000000 4917465.000000 122
A 595710.0000000 4918005.000000 22
A 601770.0000000 4916895.000000 114
A 603255.0000000 4916325.000000 116
A 605850.0000000 4916835.000000 124
A 606585.0000000 4917435.000000 110
A 606555.0000000 4917405.000000 110
A 605520.0000000 4916205.000000 128
A 606900.0000000 4916475.000000 126
A 595245.0000000 4915365.000000 12
A 597330.0000000 4916475.000000 72
A 598080.0000000 4915845.000000 74
A 595395.0000000 4916565.000000 10
A 595365.0000000 4916535.000000 10
A 594465.0000000 4916025.000000 10
A 600225.0000000 4916475.000000 114
A 602430.0000000 4915095.000000 118
A 600195.0000000 4916445.000000 114
A 599250.0000000 4915425.000000 132
A 600420.0000000 4915545.000000 134
A 606705.0000000 4916025.000000 130
A 605805.0000000 4915665.000000 130
A 604020.0000000 4915275.000000 120

On Fri, Nov 15, 2002 at 12:38:46AM +0100, Alexandra Zamparas wrote:

Hello!
Just wanted to start by thanking the people who have been answering
my questions every time, all suggestions have been very helpful. Now,
I'm looking at the dig_att file of my subbasins map and I can see the
coordinates (of the area centroid?), if it is an arc or line and the
cat.number.

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>".

Now, getting the areas for each "area" can be obtained from v.report,
but values are summarized via category numbers (so ...)

Issue 2: Why do the categories appear as even numbers? Isn't the
category number supposed to be the unique-id?

Nope, doesn't need to be. Each category is a type of thing: For
instance, you might have all "Coniferous Forests" as category number
1 and Hardwood Forests as category 2, etc...

Issue 3: Is it right that some category numbers appear more than
once?

Depends. If you want each polygon/line/point to have a unique
reference number, than you must give it a unique number. GRASS
uses an internal numbering in built vector layers, but this is
not directly useful to the user. The category number is used
to link in any external attributes (say: dig_cats/landcover).

<geometry> --> <label point> --> <category>
                 (dig_att) (dig_cats or external DB)

HTH,

--
static const char signature =
  "Copyright (c) 2002 Eric G. Miller <egm2@jps.net>";

> I'm looking at the dig_att file of my subbasins map and I can see the
> coordinates (of the area centroid?), if it is an arc or line and the
> cat.number.
>
> 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>".

SHOULD THE ABOVE READ "turn them into a category file (dig_cats/<name>)" ?

Michael

On Fri, Nov 15, 2002 at 02:30:05AM -0500, Michael Ash wrote:

> > I'm looking at the dig_att file of my subbasins map and I can see the
> > coordinates (of the area centroid?), if it is an arc or line and the
> > cat.number.
> >
> > 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>".

SHOULD THE ABOVE READ "turn them into a category file (dig_cats/<name>)" ?

Yes.

--
static const char signature =
  "Copyright (c) 2002 Eric G. Miller <egm2@jps.net>";

On Thu, 14 Nov 2002, Eric G. Miller 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?

> Issue 2: Why do the categories appear as even numbers? Isn't the
> category number supposed to be the unique-id?

Nope, doesn't need to be. Each category is a type of thing: For
instance, you might have all "Coniferous Forests" as category number
1 and Hardwood Forests as category 2, etc...

OK, sorry, I meant to say odd numbers, according to the sample file I
enclosed the previous time. I had a map with subbasins and I would
expect that the resulting file would say 1, 2, 3 etc. not 0, 2, 4,
6..Is it "acting" like this 'cause of the internal numbering system?

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.

There is actually quite much work that has to be done in vector
format and my expectations arise from other commercial software like
the "Arc's" and IDRISI32. However, I would like to stick to GRASS,
since that is mainly what my thesis is dealing with and I also
believe in its potential and the work that so many people are doing
for it. How far can I go with my vectors in GRASS 5.0.0pre3?

Warm regards,
Alexandra

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.

Radim