[GRASS5] Re: [GRASSLIST:10145] Re: v.to.db option=query: issue with 2 layers and multiple categories

Radim,

On Fri, 3 Feb 2006 19:17:42 +0100
Radim Blazek <radim.blazek@gmail.com> wrote:

On 2/3/06, Maciek Sieczka <werchowyna@epf.pl> wrote:
> On Thu, 2 Feb 2006 09:41:10 +0100
> Radim Blazek <radim.blazek@gmail.com> wrote:
>
> > If you use qcolumn=height v.to.db queries the database for this
> > point with select height from testing_pt_nodupl2_1 where cat=1 or
> > cat=2 The result is 2 rows (100.5 twice). It is impossible to
> > upload 2 values into one row in layer 2. If you have more cats in
> > queried layer on the same geometry it is necessary to use an
> > aggregate function, for example qcolumn=avg(height).
> >
> > Does it work?
>
> However, there are _also_ two categories for the same geometry in
> layer 2 (10,11). I mean - I understand I couldn't upload 2 values
> into one "row". But since in this particular case in both layer 1
> and 2 there are two "rows", isn't it somehow different? Just
> wondering.

If it is not uploaded to both rows in layer 2 (10,11) then it is a
bug.

It isn't uploaded indeed. I doublechecked on another simple example
just to make sure. The situation was as follows:

- there are categories 1,2 in layer 1; the attribute name is
"elevation"; for category 1 elevation=100, for cat 2 elevation=200.

- there are categories 10,11 in layer2; the attribute name is
"elevation2"

- trying to populate "elevation2" in layer 2 (cat 10,11) with
"elevation" from layer 1 (cat 1,2) results in an error - the
"elevation2" for cat 10,11 is set to NULL:

v.to.db map=nowy_pt_nodup type=point layer=2 qlayer=1 option=query
column=elevation2 qcolumn=elevation Reading data trom the map ... 100%
Querying database ... WARNING: Multiple query results, output value set
to NULL (category 3) 100%
WARNING: Multiple query results, output value set to NULL (category 2)
Updating database ... 100%
4 categories read from map
4 records selected from table
4 categories read from map exist in selection from table
0 categories read from map don't exist in selection from table
4 records updated/inserted
0 update/insert errors

So this is a bug? Fixable?

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/

But you are doing still the same error. You have to use
qcolumn=avg(elevation)

Radim

On 2/5/06, Maciek Sieczka <werchowyna@epf.pl> wrote:

Radim,

On Fri, 3 Feb 2006 19:17:42 +0100
Radim Blazek <radim.blazek@gmail.com> wrote:

> On 2/3/06, Maciek Sieczka <werchowyna@epf.pl> wrote:
> > On Thu, 2 Feb 2006 09:41:10 +0100
> > Radim Blazek <radim.blazek@gmail.com> wrote:
> >
> > > If you use qcolumn=height v.to.db queries the database for this
> > > point with select height from testing_pt_nodupl2_1 where cat=1 or
> > > cat=2 The result is 2 rows (100.5 twice). It is impossible to
> > > upload 2 values into one row in layer 2. If you have more cats in
> > > queried layer on the same geometry it is necessary to use an
> > > aggregate function, for example qcolumn=avg(height).
> > >
> > > Does it work?
> >
> > However, there are _also_ two categories for the same geometry in
> > layer 2 (10,11). I mean - I understand I couldn't upload 2 values
> > into one "row". But since in this particular case in both layer 1
> > and 2 there are two "rows", isn't it somehow different? Just
> > wondering.
>
> If it is not uploaded to both rows in layer 2 (10,11) then it is a
> bug.

It isn't uploaded indeed. I doublechecked on another simple example
just to make sure. The situation was as follows:

- there are categories 1,2 in layer 1; the attribute name is
"elevation"; for category 1 elevation=100, for cat 2 elevation=200.

- there are categories 10,11 in layer2; the attribute name is
"elevation2"

- trying to populate "elevation2" in layer 2 (cat 10,11) with
"elevation" from layer 1 (cat 1,2) results in an error - the
"elevation2" for cat 10,11 is set to NULL:

v.to.db map=nowy_pt_nodup type=point layer=2 qlayer=1 option=query
column=elevation2 qcolumn=elevation Reading data trom the map ... 100%
Querying database ... WARNING: Multiple query results, output value set
to NULL (category 3) 100%
WARNING: Multiple query results, output value set to NULL (category 2)
Updating database ... 100%
4 categories read from map
4 records selected from table
4 categories read from map exist in selection from table
0 categories read from map don't exist in selection from table
4 records updated/inserted
0 update/insert errors

So this is a bug? Fixable?

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/

On Mon, 6 Feb 2006 09:09:58 +0100
Radim Blazek <radim.blazek@gmail.com> wrote:

But you are doing still the same error. You have to use
qcolumn=avg(elevation)

Then I don't understand what you mean. I'm not referring to case:

1. cat 1,2@layer1 to cat 10@layer2

but to

2. cat 1,2@layer1 to cat 10,11@layer2

I thought you meant that in the case 2 it wouldn't be necessary to use
qcolumn=avg() because the number of rows in both input and output are
equal in that case. Your words:

I wrote:

> > > However, there are _also_ two categories for the same geometry
> > > in layer 2 (10,11). I mean - I understand I couldn't upload 2
> > > values into one "row". But since in this particular case in
> > > both layer 1 and 2 there are two "rows", isn't it somehow
> > > different? Just wondering.

Radim wrote:

> > If it is not uploaded to both rows in layer 2 (10,11) then it is
> > a bug.

Sorry, maybe I didn't understand. Do you mean I should use something
like qcolumn=avg() even if number of cats (rows) for a given geometry in
output layer2 and input layer1 are equal?

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/