[GRASS-dev] [bug #5219] (grass) d.vect display=cat works only for layer 1

this bug's URL: http://intevation.de/rt/webrt?serial_num=5219
-------------------------------------------------------------------------

Subject: d.vect display=cat works only for layer 1

Although I specify 'layer=2' to be queried, the 'd.vect display=shape,cat'
displays catgory numbers from layer 1, instead of layer 2.

It is reproducible with any data. Eg.:

1. v.random out=pts n=10
2. v.category input=pts output=pts2 type=point option=add cat=100 layer=2 step=10
3. d.vect pts2 layer=1 display=shape,cat
4. d.vect pts2 layer=2 display=shape,cat

You'll see the pictures of 3. and 4. are identical, while they shouldn't, as
the cats in layer 2 and layer 1 of pts2 are different,

Seems kind of related to another layer-related bug in d.vect:
https://intevation.de/rt/webrt?serial_num=4004

Maciek

-------------------------------------------- Managed by Request Tracker

Hi,

2006/10/18, Request Tracker <grass-bugs@intevation.de>:

this bug's URL: http://intevation.de/rt/webrt?serial_num=5219
-------------------------------------------------------------------------

Subject: d.vect display=cat works only for layer 1

Although I specify 'layer=2' to be queried, the 'd.vect display=shape,cat'
displays catgory numbers from layer 1, instead of layer 2.

It is reproducible with any data. Eg.:

1. v.random out=pts n=10
2. v.category input=pts output=pts2 type=point option=add cat=100 layer=2 step=10
3. d.vect pts2 layer=1 display=shape,cat
4. d.vect pts2 layer=2 display=shape,cat

You'll see the pictures of 3. and 4. are identical, while they shouldn't, as
the cats in layer 2 and layer 1 of pts2 are different,

It seems you have to specify the llayer parameter too, e.g.

d.erase;d.vect pts2 layer=2 display=shape,cat llayer=2

It is really confusing, I am not sure how to solve it. Do you think,
would be enough to print a given warning, e.g. "The layer number (2)
and layer number for labels (1) are not the same.".

Best, Martin

PS: I am really looking forward to the new bug tracker! Thanks Maciek
for working on it...

Seems kind of related to another layer-related bug in d.vect:
https://intevation.de/rt/webrt?serial_num=4004

Maciek

-------------------------------------------- Managed by Request Tracker

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Martin Landa wrote:

> this bug's URL: http://intevation.de/rt/webrt?serial_num=5219
> -------------------------------------------------------------------

..

It seems you have to specify the llayer parameter too, e.g.

d.erase;d.vect pts2 layer=2 display=shape,cat llayer=2

It is really confusing, I am not sure how to solve it. Do you think,
would be enough to print a given warning, e.g. "The layer number (2)
and layer number for labels (1) are not the same.".

It would appear to be perfectly legal to display shapes from one layer
and labels from another. So if this should be mentioned at all, it
should use G_message and not G_warning? (so --quiet makes it go away)
At minimum the label section of the d.vect help page needs to clarify
this.

Hamish

Hi,

2006/12/4, Hamish <hamish_nospam@yahoo.com>:

Martin Landa wrote:
> > this bug's URL: http://intevation.de/rt/webrt?serial_num=5219
> > -------------------------------------------------------------------
..
> It seems you have to specify the llayer parameter too, e.g.
>
> d.erase;d.vect pts2 layer=2 display=shape,cat llayer=2
>
> It is really confusing, I am not sure how to solve it. Do you think,
> would be enough to print a given warning, e.g. "The layer number (2)
> and layer number for labels (1) are not the same.".

It would appear to be perfectly legal to display shapes from one layer
and labels from another. So if this should be mentioned at all, it
should use G_message and not G_warning? (so --quiet makes it go away)
At minimum the label section of the d.vect help page needs to clarify
this.

I agree with you, the similar patch (note: without doc update)?

Best regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

d_vect_llayer.diff.gz (503 Bytes)

... oops, I forgot to test DISP_CAT, etc. The updated patch attached.

Martin

2006/12/4, Martin Landa <landa.martin@gmail.com>:

Hi,

2006/12/4, Hamish <hamish_nospam@yahoo.com>:
> Martin Landa wrote:
> > > this bug's URL: http://intevation.de/rt/webrt?serial_num=5219
> > > -------------------------------------------------------------------
> ..
> > It seems you have to specify the llayer parameter too, e.g.
> >
> > d.erase;d.vect pts2 layer=2 display=shape,cat llayer=2
> >
> > It is really confusing, I am not sure how to solve it. Do you think,
> > would be enough to print a given warning, e.g. "The layer number (2)
> > and layer number for labels (1) are not the same.".
>
> It would appear to be perfectly legal to display shapes from one layer
> and labels from another. So if this should be mentioned at all, it
> should use G_message and not G_warning? (so --quiet makes it go away)
> At minimum the label section of the d.vect help page needs to clarify
> this.

I agree with you, the similar patch (note: without doc update)?

Best regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

d_vect-llayer-2.diff.gz (548 Bytes)

Hi!

Browsing old emails I found this one I never replied to. Sorry. Please
read below.

Hamish wrote:

Martin Landa wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=5219
-------------------------------------------------------------------

..

It seems you have to specify the llayer parameter too, e.g.

d.erase;d.vect pts2 layer=2 display=shape,cat llayer=2

It is really confusing, I am not sure how to solve it. Do you think,
would be enough to print a given warning, e.g. "The layer number (2)
and layer number for labels (1) are not the same.".

It would appear to be perfectly legal to display shapes from one layer
and labels from another.

Hamish is correct. However, it seems to me that when the user runs:

d.vect pts2 layer=2 display=shape,cat

he will expect that categories for layer 2 will be displayed, not for
layer 1, as it happens currently. Only if he really wants to display
geometry from layer 2 and categories (or other labels) belonging to
layer 1, he should have to explicitely set llayer=1.

The conclussion is, if my thinking is correct: shouldn't llayer default
to layer, if not explicitely requested differently?

If this was implemented, the warning which Matin proposed in his patch
would be redundant.

Cheers
Maciek

Maciej Sieczka wrote:

d.vect pts2 layer=2 display=shape,cat

he will expect that categories for layer 2 will be displayed, not for
layer 1, as it happens currently.

as it happens currently if the user sets llayer incorrectly (by not
setting it at all).

Only if he really wants to display geometry from layer 2 and
categories (or other labels) belonging to layer 1, he should have to
explicitely set llayer=1.

The conclussion is, if my thinking is correct: shouldn't llayer
default to layer, if not explicitely requested differently?

easier said than done; the parser can't know before hand what the answer
to another option will be. but it is possible to give it no default and
add to the llayer's option description that it will use the layer= answer
if not given. While possible, I'm still not sure if it's advisable. (shrug)

Hamish

Hi,

2007/2/19, Hamish <hamish_nospam@yahoo.com>:

easier said than done; the parser can't know before hand what the answer
to another option will be. but it is possible to give it no default and
add to the llayer's option description that it will use the layer= answer
if not given. While possible, I'm still not sure if it's advisable. (shrug)

it could be implemented like this (see the patch) for example. Just I
am also not sure, maybe it is better for the user to set up the llayer
according to layer parameter(?)

Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

d-vect-llayer-1.diff (1.15 KB)

BTW, it should fix

https://intevation.de/rt/webrt?serial_num=4004
https://intevation.de/rt/webrt?serial_num=5219

I vote for using layer number given by the layer parameter as default
layer number for labels.

Martin

2007/2/19, Martin Landa <landa.martin@gmail.com>:

Hi,

2007/2/19, Hamish <hamish_nospam@yahoo.com>:

> easier said than done; the parser can't know before hand what the answer
> to another option will be. but it is possible to give it no default and
> add to the llayer's option description that it will use the layer= answer
> if not given. While possible, I'm still not sure if it's advisable. (shrug)

it could be implemented like this (see the patch) for example. Just I
am also not sure, maybe it is better for the user to set up the llayer
according to layer parameter(?)

Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

I don't have strong feelings either way, but this sounds reasonable and
understandable from a user's point of view.

Michael

On 2/19/07 7:32 AM, "Martin Landa" <landa.martin@gmail.com> wrote:

BTW, it should fix

https://intevation.de/rt/webrt?serial_num=4004
https://intevation.de/rt/webrt?serial_num=5219

I vote for using layer number given by the layer parameter as default
layer number for labels.

Martin

2007/2/19, Martin Landa <landa.martin@gmail.com>:

Hi,

2007/2/19, Hamish <hamish_nospam@yahoo.com>:

easier said than done; the parser can't know before hand what the answer
to another option will be. but it is possible to give it no default and
add to the llayer's option description that it will use the layer= answer
if not given. While possible, I'm still not sure if it's advisable. (shrug)

it could be implemented like this (see the patch) for example. Just I
am also not sure, maybe it is better for the user to set up the llayer
according to layer parameter(?)

Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

I don't have strong feelings either way, but this sounds reasonable and
understandable from a user's point of view.

+1

Maciek

Martin Landa wrote:

+ lfield_opt->answer = NULL;

Not needed. G_define_option() sets that to null already.

Hamish

Hi,

but there is used G_define_standard_option(G_OPT_V_FIELD)
(G_define_option() could be used also) which sets answer to "1". Not
sure if I understand well.

Regards,

         Martin

2007/2/19, Hamish <hamish_nospam@yahoo.com>:

Martin Landa wrote:
> + lfield_opt->answer = NULL;

Not needed. G_define_option() sets that to null already.

Hamish

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Hi,

I committed the changes to CVS (I used G_define_option() instead of
G_define_standard_option()). Closing the bugs/wishes number 4004 and
5219.

Martin

2007/2/20, Martin Landa <landa.martin@gmail.com>:

Hi,

but there is used G_define_standard_option(G_OPT_V_FIELD)
(G_define_option() could be used also) which sets answer to "1". Not
sure if I understand well.

Regards,

         Martin

2007/2/19, Hamish <hamish_nospam@yahoo.com>:
> Martin Landa wrote:
> > + lfield_opt->answer = NULL;
>
> Not needed. G_define_option() sets that to null already.
>
> Hamish
>

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Hi,

I am just not sure about fixing this:

https://intevation.de/rt/webrt?serial_num=4004&display=History

* the changes which I made in CVS have no connection with this bug
* on the other hand, it seems to work OK for me (i.e. I cannot
reproduce described behaviour)

Martin

2007/2/20, Martin Landa <landa.martin@gmail.com>:

Hi,

I committed the changes to CVS (I used G_define_option() instead of
G_define_standard_option()). Closing the bugs/wishes number 4004 and
5219.

Martin

2007/2/20, Martin Landa <landa.martin@gmail.com>:
> Hi,
>
> but there is used G_define_standard_option(G_OPT_V_FIELD)
> (G_define_option() could be used also) which sets answer to "1". Not
> sure if I understand well.
>
> Regards,
>
> Martin
>
> 2007/2/19, Hamish <hamish_nospam@yahoo.com>:
> > Martin Landa wrote:
> > > + lfield_opt->answer = NULL;
> >
> > Not needed. G_define_option() sets that to null already.
> >
> > Hamish
> >
>
> --
> Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
>

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Martin Landa wrote:

Hi,

I committed the changes to CVS (I used G_define_option() instead of
G_define_standard_option()). Closing the bugs/wishes number 4004 and
5219.

Works great. Thanks for doing this Martin!

Maciek