Browse Source

pythonlib: follow param naming convention

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44815 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 years ago
parent
commit
0ead1e5808
2 changed files with 13 additions and 12 deletions
  1. 1 1
      gui/wxpython/gui_modules/dbm_base.py
  2. 12 11
      lib/python/vector.py

+ 1 - 1
gui/wxpython/gui_modules/dbm_base.py

@@ -90,7 +90,7 @@ class VectorDBInfo(gselect.VectorDBInfo):
         line = None
         nselected = 0
 
-        data = grass.vector_what(name = self.map,
+        data = grass.vector_what(map = self.map,
                                  coord = (float(queryCoords[0]), float(queryCoords[1])),
                                  distance = float(qdist))
 

+ 12 - 11
lib/python/vector.py

@@ -24,6 +24,7 @@ for details.
 
 import os
 import types
+import __builtin__
 
 from core import *
 
@@ -219,12 +220,12 @@ def vector_db_select(map, layer = 1, **kwargs):
              'values' : values }
 
 # interface to v.what
-def vector_what(name, coord, distance = 0.0):
+def vector_what(map, coord, distance = 0.0):
     """!Query vector map at given locations
     
     To query one vector map at one location
     @code
-    print grass.vector_what(name = 'archsites', coord = (595743, 4925281), distance = 250)
+    print grass.vector_what(map = 'archsites', coord = (595743, 4925281), distance = 250)
 
     [{'Category': 8, 'Map': 'archsites', 'Layer': 1, 'Key_column': 'cat',
       'Database': '/home/martin/grassdata/spearfish60/PERMANENT/dbf/',
@@ -235,7 +236,7 @@ def vector_what(name, coord, distance = 0.0):
 
     To query one vector map at more locations
     @code
-    for q in grass.vector_what(name = ('archsites', 'roads'), coord = (595743, 4925281),
+    for q in grass.vector_what(map = ('archsites', 'roads'), coord = (595743, 4925281),
                                distance = 250):
         print q['Map'], q['Attributes']
                             
@@ -245,7 +246,7 @@ def vector_what(name, coord, distance = 0.0):
 
     To query more vector maps at one location
     @code
-    for q in grass.vector_what(name = 'archsites', coord = [(595743, 4925281), (597950, 4918898)],
+    for q in grass.vector_what(map = 'archsites', coord = [(595743, 4925281), (597950, 4918898)],
                                distance = 250):
         print q['Map'], q['Attributes']
 
@@ -253,7 +254,7 @@ def vector_what(name, coord, distance = 0.0):
     archsites {'str1': 'Bob_Miller', 'cat': '22'}
     @endcode
 
-    @param name vector map(s) to query given as string or list/tuple
+    @param map vector map(s) to query given as string or list/tuple
     @param coord coordinates of query given as tuple (easting, northing) or list of tuples
     @param distance query threshold distance (in map units)
 
@@ -263,12 +264,12 @@ def vector_what(name, coord, distance = 0.0):
         locale = os.environ["LC_ALL"]
         os.environ["LC_ALL"] = "C"
 
-    if type(name) in (types.StringType, types.UnicodeType):
-        name_list = [name]
+    if type(map) in (types.StringType, types.UnicodeType):
+        map_list = [map]
     else:
-        name_list = name
+        map_list = map
     
-    layer_list = ['-1'] * len(name_list)
+    layer_list = ['-1'] * len(map_list)
     
     coord_list = list()
     if type(coord) is types.TupleType:
@@ -280,7 +281,7 @@ def vector_what(name, coord, distance = 0.0):
     ret = read_command('v.what',
                        quiet      = True,
                        flags      = 'ag',
-                       map        = ','.join(name_list),
+                       map        = ','.join(map_list),
                        layer      = ','.join(layer_list),
                        east_north = ','.join(coord_list),
                        distance   = float(distance))
@@ -295,7 +296,7 @@ def vector_what(name, coord, distance = 0.0):
     dict_attrb = None
     for item in ret.splitlines():
         try:
-            key, value = map(lambda x: x.strip(), item.split('=', 1))
+            key, value = __builtin__.map(lambda x: x.strip(), item.split('=', 1))
         except ValueError:
             continue
         if key in ('East', 'North'):