[GRASS-SVN] r52478 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jul 30 09:20:49 PDT 2012
Author: annakrat
Date: 2012-07-30 09:20:49 -0700 (Mon, 30 Jul 2012)
New Revision: 52478
Modified:
grass/trunk/lib/python/vector.py
Log:
pythonlib/vector: add option to query different topology types (related to r52425)
Modified: grass/trunk/lib/python/vector.py
===================================================================
--- grass/trunk/lib/python/vector.py 2012-07-30 06:55:50 UTC (rev 52477)
+++ grass/trunk/lib/python/vector.py 2012-07-30 16:20:49 UTC (rev 52478)
@@ -269,7 +269,7 @@
'values' : values }
# interface to v.what
-def vector_what(map, coord, distance = 0.0):
+def vector_what(map, coord, distance = 0.0, ttype = None):
"""!Query vector map at given locations
To query one vector map at one location
@@ -306,6 +306,7 @@
@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)
+ @param ttype list of topology types (default of v.what are point, line, area, face)
@return parsed list
"""
@@ -327,13 +328,17 @@
for e, n in coord:
coord_list.append('%f,%f' % (e, n))
+ cmdParams = dict(quiet = True,
+ flags = 'ag',
+ map = ','.join(map_list),
+ layer = ','.join(layer_list),
+ coordinates = ','.join(coord_list),
+ distance = float(distance))
+ if ttype:
+ cmdParams['type'] = ','.join(ttype)
+
ret = read_command('v.what',
- quiet = True,
- flags = 'ag',
- map = ','.join(map_list),
- layer = ','.join(layer_list),
- coordinates = ','.join(coord_list),
- distance = float(distance))
+ **cmdParams)
if "LC_ALL" in os.environ:
os.environ["LC_ALL"] = locale
More information about the grass-commit
mailing list