[GRASS-SVN] r44817 - in grass/branches/develbranch_6:
gui/wxpython/gui_modules lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 30 14:08:31 EST 2010
Author: martinl
Date: 2010-12-30 11:08:31 -0800 (Thu, 30 Dec 2010)
New Revision: 44817
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py
grass/branches/develbranch_6/lib/python/vector.py
Log:
pythonlib: follow param naming convention
(merge r44815 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py 2010-12-30 19:04:52 UTC (rev 44816)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py 2010-12-30 19:08:31 UTC (rev 44817)
@@ -90,7 +90,7 @@
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))
Modified: grass/branches/develbranch_6/lib/python/vector.py
===================================================================
--- grass/branches/develbranch_6/lib/python/vector.py 2010-12-30 19:04:52 UTC (rev 44816)
+++ grass/branches/develbranch_6/lib/python/vector.py 2010-12-30 19:08:31 UTC (rev 44817)
@@ -24,6 +24,7 @@
import os
import types
+import __builtin__
from core import *
@@ -219,12 +220,12 @@
'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 @@
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 @@
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 @@
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,11 +264,11 @@
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
+
coord_list = list()
if type(coord) is types.TupleType:
coord_list.append('%f,%f' % (coord[0], coord[1]))
@@ -278,7 +279,7 @@
ret = read_command('v.what',
quiet = True,
flags = 'ag',
- map = ','.join(name_list),
+ map = ','.join(map_list),
east_north = ','.join(coord_list),
distance = float(distance))
@@ -292,7 +293,7 @@
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'):
More information about the grass-commit
mailing list