[GRASS-user] map query tool in 6.4.2RC1 ???

Hi again all,

In 6.4.1 wxGUI, I noticed that the query tool icon in map display gave
user an option to query (display mode) or query (edit mode) - the former
showed details in output window, the latter opened a dialog box allowing
view/edit of data in connected table.

now in 6.4.2RC1, there does not seem to be an option to choose - I click
the tool, then clicking on the map does the 'edit' option of opening
dialog to view/edit data in table.... if/when it works that is...

A problem I find, is that some things I click on don't give results, I
get this sort of error:

Traceback (most recent call last):
  File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
_window.py", line 1017, in MouseActions

self.OnLeftUp(event)
  File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
_window.py", line 1207, in OnLeftUp

self.parent.QueryVector(self.mouse['begin'][0],
self.mouse['begin'][1])
  File
"/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp.py",
line 1382, in QueryVector

action = mode)
  File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
logs.py", line 104, in __init__

self.UpdateDialog(query = query, cats = cats)
  File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
logs.py", line 362, in UpdateDialog

query[1])
  File
"/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_base.py",
line 109, in SelectByPoint

if self.tables[table][key]['ctype'] != types.StringType:
KeyError
:
'grthrs_pax'

...........
I get similar message with different last line for different vectors I
query, but it seems to be having an issue with certain columns from
connected tables? for one vector as above, it is the last column of the
table connected on layer 3. column is "character varying(20)"

On another vector, I get similar message and it is the last column of
the table connected on layer 2, format "integer"

Yet I can go to another vector, that has "integer" "double precision"
and "character" and the edit dialog box will pop up when I click on the
map.

I am using Postgres db.

Any hints? Also, if it's something serious, should I head over to
reporting it as a bug and/or posting to the dev mailing list?

-Shane.

Hi,

2011/10/20 Shane Litherland <litherland-farm@bigpond.com>:

In 6.4.1 wxGUI, I noticed that the query tool icon in map display gave
user an option to query (display mode) or query (edit mode) - the former
showed details in output window, the latter opened a dialog box allowing
view/edit of data in connected table.

now in 6.4.2RC1, there does not seem to be an option to choose - I click
the tool, then clicking on the map does the 'edit' option of opening
dialog to view/edit data in table.... if/when it works that is...

right, querying options has been simplified. For vector maps it's
shown wxGUI dialog with results, querying raster maps is still
redirected to command output window.

A problem I find, is that some things I click on don't give results, I
get this sort of error:

Traceback (most recent call last):
File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
_window.py", line 1017, in MouseActions

self.OnLeftUp(event)
File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
_window.py", line 1207, in OnLeftUp

self.parent.QueryVector(self.mouse['begin'][0],
self.mouse['begin'][1])
File
"/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp.py",
line 1382, in QueryVector

action = mode)
File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
logs.py", line 104, in __init__

self.UpdateDialog(query = query, cats = cats)
File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
logs.py", line 362, in UpdateDialog

query[1])
File
"/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_base.py",
line 109, in SelectByPoint

if self.tables[table][key]['ctype'] != types.StringType:
KeyError
:
'grthrs_pax'

...........
I get similar message with different last line for different vectors I
query, but it seems to be having an issue with certain columns from
connected tables? for one vector as above, it is the last column of the
table connected on layer 3. column is "character varying(20)"

On another vector, I get similar message and it is the last column of
the table connected on layer 2, format "integer"

Yet I can go to another vector, that has "integer" "double precision"
and "character" and the edit dialog box will pop up when I click on the
map.

could you send `v.db.connect -g` and `v.info -c` output for
problematic sample vector map?

Martin

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

Hi Martin,
thanks for confirmation on query tool operation :slight_smile:

Further on the other issue (below):

> A problem I find, is that some things I click on don't give results, I
> get this sort of error:
>
> Traceback (most recent call last):
> File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
> _window.py", line 1017, in MouseActions
>
> self.OnLeftUp(event)
> File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
> _window.py", line 1207, in OnLeftUp
>
> self.parent.QueryVector(self.mouse['begin'][0],
> self.mouse['begin'][1])
> File
> "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp.py",
> line 1382, in QueryVector
>
> action = mode)
> File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
> logs.py", line 104, in __init__
>
> self.UpdateDialog(query = query, cats = cats)
> File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
> logs.py", line 362, in UpdateDialog
>
> query[1])
> File
> "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_base.py",
> line 109, in SelectByPoint
>
> if self.tables[table][key]['ctype'] != types.StringType:
> KeyError
> :
> 'grthrs_pax'
>
> ...........
> I get similar message with different last line for different vectors I
> query, but it seems to be having an issue with certain columns from
> connected tables? for one vector as above, it is the last column of the
> table connected on layer 3. column is "character varying(20)"
>
> On another vector, I get similar message and it is the last column of
> the table connected on layer 2, format "integer"
>
> Yet I can go to another vector, that has "integer" "double precision"
> and "character" and the edit dialog box will pop up when I click on the
> map.

could you send `v.db.connect -g` and `v.info -c` output for
problematic sample vector map?

Martin

Here's output from a vector that query tool did work on:
v.db.connect -g
map=VIP_transects@Lacebark
1 public.VIP_transects cat gisdb pg

v.info -c
map=VIP_transects@Lacebark
INTEGER|cat
INTEGER|vip
INTEGER|transect
DOUBLE PRECISION|startx
DOUBLE PRECISION|starty
DOUBLE PRECISION|endx
DOUBLE PRECISION|endy
CHARACTER|notes
Displaying column types/names for database connection of layer 1:

Below is output for a vector that it gave error on, but whilst I was
checking this problem, I found that the query tool did work for a couple
of centroids that ONLY had data in a connection with table one (happens
to be vectors I am still updating info for other layers) So that may
help narrow down the possibilities i.e. it may not be the entire vector
that causes error, but maybe only when querying something which should
return info for >1 table connections.

Note I also have multiple entries within each layer for a given
centroid, I don't think I can confirm if that is or isn't an issue
whilst the current error stops me from getting any query result for such
attributes.

v.db.connect -g
map=GRT10_11@Lacebark
1 GRT_prevalence cat gisdb pg
2 chemical_use cat gisdb pg
3 grt_hours cat gisdb pg

v.info -c
map=GRT10_11@Lacebark
INTEGER|cat
DATE|grt_date
INTEGER|plant_rank
INTEGER|seed_rank
CHARACTER|treatment
CHARACTER|notes
DOUBLE PRECISION|grt_score
CHARACTER|grassrgb
Displaying column types/names for database connection of layer 1:

v.info -c map=GRT10_11@Lacebark
layer=2
INTEGER|cat
DATE|chem_date
CHARACTER|chemical
DOUBLE PRECISION|chem_vol
CHARACTER|additives
DOUBLE PRECISION|mix_vol
CHARACTER|method
CHARACTER|area
CHARACTER|target
DOUBLE PRECISION|hours
CHARACTER|chem_notes
INTEGER|chem_conc
Displaying column types/names for database connection of layer 2:

v.info -c map=GRT10_11@Lacebark
layer=3
INTEGER|cat
DATE|grthrs_date
DOUBLE PRECISION|grt_hrs
CHARACTER|grthrs_notes
CHARACTER|grthrs_pax
Displaying column types/names for database connection of layer 3:

Let me know if any more sleuthing required at this end :slight_smile:

-shane

Hi Martin and mailing list,

corresponded awhile back regarding query tool giving error message when
used on vector/s that had connections to different tables on two or
three layers and/or had multiple cats on a layer.

I have used the tool again, now in 6.4 svn updated today (ver50505)
with debug=5 output in the terminal.

I can click on a vector item (e.g. centroid) with multiple connections
and in the terminal the output appears to show the data for each of the
cats on whatever layer they are. It is only towards the end of the
process that I see error messages, seeming to relate to python
commands/modules?? and nothing appears in the GRASS gui area (e.g.
dialog box showing data retrieved from tables).

I was going to try and repeat this in the north carolina dataset... so
the output was more meaningful than referring to my own tables etc...
there's quite a few vectors in NC, can anyone suggest one that has more
than one table connection existing, to save me the time of going through
each vector looking up database connection specifics? It seems most or
all of them have their own dbf file, but are any connected to multiple
tables?

If not, are there any particular vectors/tables that someone would like
me to use from the NC dataset to test/repeat this issue?

regards,
shane.

On Fri, 2011-10-21 at 12:27 +1000, Shane Litherland wrote:

Hi Martin,
thanks for confirmation on query tool operation :slight_smile:

Further on the other issue (below):
> > A problem I find, is that some things I click on don't give results, I
> > get this sort of error:
> >
> > Traceback (most recent call last):
> > File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
> > _window.py", line 1017, in MouseActions
> >
> > self.OnLeftUp(event)
> > File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp
> > _window.py", line 1207, in OnLeftUp
> >
> > self.parent.QueryVector(self.mouse['begin'][0],
> > self.mouse['begin'][1])
> > File
> > "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/mapdisp.py",
> > line 1382, in QueryVector
> >
> > action = mode)
> > File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
> > logs.py", line 104, in __init__
> >
> > self.UpdateDialog(query = query, cats = cats)
> > File "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_dia
> > logs.py", line 362, in UpdateDialog
> >
> > query[1])
> > File
> > "/usr/grass-6.4.2RC1/etc/wxpython/gui_modules/dbm_base.py",
> > line 109, in SelectByPoint
> >
> > if self.tables[table][key]['ctype'] != types.StringType:
> > KeyError
> > :
> > 'grthrs_pax'
> >
> > ...........
> > I get similar message with different last line for different vectors I
> > query, but it seems to be having an issue with certain columns from
> > connected tables? for one vector as above, it is the last column of the
> > table connected on layer 3. column is "character varying(20)"
> >
> > On another vector, I get similar message and it is the last column of
> > the table connected on layer 2, format "integer"
> >
> > Yet I can go to another vector, that has "integer" "double precision"
> > and "character" and the edit dialog box will pop up when I click on the
> > map.
>
> could you send `v.db.connect -g` and `v.info -c` output for
> problematic sample vector map?
>
> Martin
>
Here's output from a vector that query tool did work on:
v.db.connect -g
map=VIP_transects@Lacebark
1 public.VIP_transects cat gisdb pg

v.info -c
map=VIP_transects@Lacebark
INTEGER|cat
INTEGER|vip
INTEGER|transect
DOUBLE PRECISION|startx
DOUBLE PRECISION|starty
DOUBLE PRECISION|endx
DOUBLE PRECISION|endy
CHARACTER|notes
Displaying column types/names for database connection of layer 1:

Below is output for a vector that it gave error on, but whilst I was
checking this problem, I found that the query tool did work for a couple
of centroids that ONLY had data in a connection with table one (happens
to be vectors I am still updating info for other layers) So that may
help narrow down the possibilities i.e. it may not be the entire vector
that causes error, but maybe only when querying something which should
return info for >1 table connections.

Note I also have multiple entries within each layer for a given
centroid, I don't think I can confirm if that is or isn't an issue
whilst the current error stops me from getting any query result for such
attributes.

v.db.connect -g
map=GRT10_11@Lacebark
1 GRT_prevalence cat gisdb pg
2 chemical_use cat gisdb pg
3 grt_hours cat gisdb pg

v.info -c
map=GRT10_11@Lacebark
INTEGER|cat
DATE|grt_date
INTEGER|plant_rank
INTEGER|seed_rank
CHARACTER|treatment
CHARACTER|notes
DOUBLE PRECISION|grt_score
CHARACTER|grassrgb
Displaying column types/names for database connection of layer 1:

v.info -c map=GRT10_11@Lacebark
layer=2
INTEGER|cat
DATE|chem_date
CHARACTER|chemical
DOUBLE PRECISION|chem_vol
CHARACTER|additives
DOUBLE PRECISION|mix_vol
CHARACTER|method
CHARACTER|area
CHARACTER|target
DOUBLE PRECISION|hours
CHARACTER|chem_notes
INTEGER|chem_conc
Displaying column types/names for database connection of layer 2:

v.info -c map=GRT10_11@Lacebark
layer=3
INTEGER|cat
DATE|grthrs_date
DOUBLE PRECISION|grt_hrs
CHARACTER|grthrs_notes
CHARACTER|grthrs_pax
Displaying column types/names for database connection of layer 3:

Let me know if any more sleuthing required at this end :slight_smile:

-shane