瀏覽代碼

pythonlib: vector_what(): add new parameter to skip quering attributes (no backport is needed)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67640 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 年之前
父節點
當前提交
05089a48e4
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 1 1
      gui/wxpython/gui_core/vselect.py
  2. 4 2
      lib/python/script/vector.py

+ 1 - 1
gui/wxpython/gui_core/vselect.py

@@ -273,7 +273,7 @@ class VectorSelectBase():
         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)

+ 4 - 2
lib/python/script/vector.py

@@ -266,7 +266,7 @@ json = None
 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 @@ def vector_what(map, coord, distance=0.0, ttype=None, encoding=None):
     :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 @@ def vector_what(map, coord, distance=0.0, ttype=None, encoding=None):
             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),