[GRASS-SVN] r71113 - grass/trunk/lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 23 02:00:31 PDT 2017


Author: lucadelu
Date: 2017-05-23 02:00:31 -0700 (Tue, 23 May 2017)
New Revision: 71113

Modified:
   grass/trunk/lib/python/script/vector.py
Log:
python vector scripting library: added layer variable to vector_info and vector_info_topo functions

Modified: grass/trunk/lib/python/script/vector.py
===================================================================
--- grass/trunk/lib/python/script/vector.py	2017-05-23 08:58:33 UTC (rev 71112)
+++ grass/trunk/lib/python/script/vector.py	2017-05-23 09:00:31 UTC (rev 71113)
@@ -151,7 +151,7 @@
     run_command('v.support', map=map, cmdhist=os.environ['CMDLINE'])
 
 
-def vector_info_topo(map):
+def vector_info_topo(map, layer=1):
     """Return information about a vector map (interface to `v.info -t`).
     Example:
 
@@ -161,10 +161,11 @@
     'areas': 1832}
 
     :param str map: map name
+    :param int layer: layer number
 
     :return: parsed output
     """
-    s = read_command('v.info', flags='t', map=map)
+    s = read_command('v.info', flags='t', layer=layer, map=map)
     ret = parse_key_val(s, val_type=int)
     if 'map3d' in ret:
         ret['map3d'] = bool(ret['map3d'])
@@ -172,7 +173,7 @@
     return ret
 
 
-def vector_info(map):
+def vector_info(map, layer=1):
     """Return information about a vector map (interface to
     `v.info`). Example:
 
@@ -180,11 +181,12 @@
     {'comment': '', 'projection': 'Lambert Conformal Conic' ... 'south': 10875.8272320917}
 
     :param str map: map name
+    :param int layer: layer number
 
     :return: parsed vector info
     """
 
-    s = read_command('v.info', flags='get', map=map)
+    s = read_command('v.info', flags='get', layer=layer, map=map)
 
     kv = parse_key_val(s)
     for k in ['north', 'south', 'east', 'west', 'top', 'bottom']:
@@ -217,7 +219,7 @@
     ['Zml']
 
     :param str map: map name
-    :param str layer: layer number
+    :param int layer: layer number
     :param kwargs: v.db.select options
 
     :return: dictionary ('columns' and 'values')



More information about the grass-commit mailing list