Opened 8 years ago

Closed 7 years ago

#1651 closed defect (fixed)

Map display Query Vector tool fails

Reported by: vincent Owned by: grass-dev@…
Priority: normal Milestone: 6.4.3
Component: wxGUI Version: svn-releasebranch64
Keywords: query, vector Cc:
CPU: Unspecified Platform: Linux

Description

When simply displaying a contour line vector, the Query Tool (this located in the map display toolbar) works fine, i.e. in my case one can access z values stored in the related attribute table. Attributes are stored in a postgres DB. Then I change the display rule for the map, e.g. only showing major contour lines, via this 'where' argument :

z % 50 = 0

Now the Query Tool fails, giving this error message :

Traceback (most recent call last):
  File "/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/mapwi
ndow.py", line 904, in MouseActions

self.OnLeftUp(event)
  File "/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/mapwi
ndow.py", line 1105, in OnLeftUp

self.parent.QueryVector(self.mouse['begin'][0],
self.mouse['begin'][1])
  File
"/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/frame.py",
line 809, in QueryVector

qlayer = self.AddTmpVectorMapLayer(mapName, cats, useId =
False)
  File
"/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/frame.py",
line 862, in AddTmpVectorMapLayer

parg,pval = p.split('=')
ValueError
:
too many values to unpack

Invoking a more "sql-basical" condition (e.g. z > 1800), this error does not happen.

Change History (5)

comment:1 Changed 7 years ago by neteler

Keywords: query vector added; queryvector removed

I have made a test with the NC data:

g.region rast=elev_lid792_1m -p
r.contour elev_lid792_1m out=contours step=2.5
v.univar contours type=line col=level

Then loading the map into the display, right-mouse to define Properties -> Selection -> WHERE -> level % 100 = 0

It no longer crashes but generates a DBMI/DBF error since "%" is not supported. That looks correct. For SQLite and PostgreSQL it should work.

Can you please retry with a current 6.4.svn version?

comment:2 in reply to:  1 Changed 7 years ago by vincent

Replying to neteler:

Can you please retry with a current 6.4.svn version?

Ok for db driver case.

But same contour map created against pg driver returns an error on request.

Loading the map in the display, right-mouse to define Properties -> Selection -> WHERE -> cast(level as decimal) % 10 = 0

There is no error on display, ie the sql filter works. But when you want to query the map (display window : query raster/vector map(s) tool), it fails, returning this error :

Traceback (most recent call last):
  File "/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/mapwi
ndow.py", line 914, in MouseActions

self.OnLeftUp(event)
  File "/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/mapwi
ndow.py", line 1120, in OnLeftUp

self.parent.Query(self.mouse['begin'][0],self.mouse['begin']
[1], layers)
  File
"/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/frame.py",
line 681, in Query

self.QueryVector(east, north, qdist, posWindow, layers[0])
  File
"/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/frame.py",
line 827, in QueryVector

qlayer = self.AddTmpVectorMapLayer(mapName, cats, useId =
False)
  File
"/usr/local/grass-6.4.3svn/etc/wxpython/mapdisp/frame.py",
line 880, in AddTmpVectorMapLayer

parg,pval = p.split('=')
ValueError
:
too many values to unpack

comment:3 Changed 7 years ago by annakrat

This error is fixed in r52928. If everything works, please close the ticket.

comment:4 in reply to:  3 ; Changed 7 years ago by vincent

Replying to annakrat:

This error is fixed in r52928. If everything works, please close the ticket.

Ok, it works but... (sorry for quibbling) : query tool detects sql-filtered objects too. Is it a desirable behavior ? or should hidden features be unrequestable ?

comment:5 in reply to:  4 Changed 7 years ago by wenzeslaus

Resolution: fixed
Status: newclosed

Replying to vincent:

Ok, it works but... (sorry for quibbling) : query tool detects sql-filtered objects too. Is it a desirable behavior ? or should hidden features be unrequestable ?

wxGUI uses v.what module for querying and v.what doesn't have 'where condition' parameter. But probably can have. At least for wxGUI it makes sense.

If you want this implemented, please create new ticket. I would suggest you to create one enhancement for v.what (where condition parameter) and one defect for wxGUI (querying vector map displayed with where condition parameter).

Note: See TracTickets for help on using tickets.