[GRASS-dev] [GRASS GIS] #1651: Map display Query Vector tool fails

#1651: Map display Query Vector tool fails
-------------------------+--------------------------------------------------
Reporter: vincent | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: queryvector | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1651&gt;
GRASS GIS <http://grass.osgeo.org>

#1651: Map display Query Vector tool fails
---------------------------+------------------------------------------------
Reporter: vincent | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: query, vector | Platform: Linux
      Cpu: Unspecified |
---------------------------+------------------------------------------------
Changes (by neteler):

  * keywords: queryvector => query, vector

Comment:

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?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1651#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1651: Map display Query Vector tool fails
---------------------------+------------------------------------------------
Reporter: vincent | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: query, vector | Platform: Linux
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by vincent):

Replying to [comment:1 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

}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1651#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1651: Map display Query Vector tool fails
---------------------------+------------------------------------------------
Reporter: vincent | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: query, vector | Platform: Linux
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by annakrat):

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1651#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1651: Map display Query Vector tool fails
---------------------------+------------------------------------------------
Reporter: vincent | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: query, vector | Platform: Linux
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by vincent):

Replying to [comment:3 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 ?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1651#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1651: Map display Query Vector tool fails
----------------------+-----------------------------------------------------
  Reporter: vincent | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Resolution: fixed | Keywords: query, vector
  Platform: Linux | Cpu: Unspecified
----------------------+-----------------------------------------------------
Changes (by wenzeslaus):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:4 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).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1651#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>