[GRASS-SVN] r67640 - in grass/trunk: gui/wxpython/gui_core lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 23 08:35:35 PST 2016


Author: martinl
Date: 2016-01-23 08:35:35 -0800 (Sat, 23 Jan 2016)
New Revision: 67640

Modified:
   grass/trunk/gui/wxpython/gui_core/vselect.py
   grass/trunk/lib/python/script/vector.py
Log:
pythonlib: vector_what(): add new parameter to skip quering attributes (no backport is needed)

Modified: grass/trunk/gui/wxpython/gui_core/vselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/vselect.py	2016-01-23 15:49:49 UTC (rev 67639)
+++ grass/trunk/gui/wxpython/gui_core/vselect.py	2016-01-23 16:35:35 UTC (rev 67640)
@@ -273,7 +273,7 @@
         try:
             query = grass.vector_what(map=[self.mapName],
                                       coord=self.mapWin.GetLastEN(),
-                                      distance=threshold)
+                                      distance=threshold, skip_attributes=True)
         except grass.ScriptError:
             GError(parent=self,
                    message=_("Failed to query vector map(s) <%s>.") % self.map)

Modified: grass/trunk/lib/python/script/vector.py
===================================================================
--- grass/trunk/lib/python/script/vector.py	2016-01-23 15:49:49 UTC (rev 67639)
+++ grass/trunk/lib/python/script/vector.py	2016-01-23 16:35:35 UTC (rev 67640)
@@ -266,7 +266,7 @@
 orderedDict = None
 
 
-def vector_what(map, coord, distance=0.0, ttype=None, encoding=None):
+def vector_what(map, coord, distance=0.0, ttype=None, encoding=None, skip_attributes=False):
     """Query vector map at given locations
 
     To query one vector map at one location
@@ -322,6 +322,8 @@
     :param distance: query threshold distance (in map units)
     :param ttype: list of topology types (default of v.what are point, line,
                   area, face)
+    :param encoding: attributes encoding
+    :param skip_attributes: True to skip quering attributes
 
     :return: parsed list
     """
@@ -344,7 +346,7 @@
             coord_list.append('%f,%f' % (e, n))
 
     cmdParams = dict(quiet      = True,
-                     flags      = 'aj',
+                     flags      = 'j' if skip_attributes else 'aj',
                      map        = ','.join(map_list),
                      layer      = ','.join(layer_list),
                      coordinates = ','.join(coord_list),



More information about the grass-commit mailing list