[GRASS-SVN] r73393 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 25 07:13:06 PDT 2018


Author: martinl
Date: 2018-09-25 07:13:05 -0700 (Tue, 25 Sep 2018)
New Revision: 73393

Modified:
   grass/trunk/lib/python/pygrass/vector/__init__.py
Log:
pygrass wrongly reports lines for point vector maps, see #3549

Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py	2018-09-24 20:41:08 UTC (rev 73392)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py	2018-09-25 14:13:05 UTC (rev 73393)
@@ -27,8 +27,8 @@
           "holes": libvect.Vect_get_num_holes,
           "islands": libvect.Vect_get_num_islands,
           "kernels": libvect.Vect_get_num_kernels,
-          "points": libvect.Vect_get_num_lines,
-          "lines": libvect.Vect_get_num_lines,
+          "points": (libvect.Vect_get_num_primitives, libvect.GV_POINT),
+          "lines": (libvect.Vect_get_num_primitives, libvect.GV_LINE),
           "nodes": libvect.Vect_get_num_nodes,
           "updated_lines": libvect.Vect_get_num_updated_lines,
           "updated_nodes": libvect.Vect_get_num_updated_nodes,
@@ -370,7 +370,11 @@
         ..
         """
         if vtype in _NUMOF.keys():
-            return _NUMOF[vtype](self.c_mapinfo)
+            if isinstance(_NUMOF[vtype], tuple):
+                fn, ptype = _NUMOF[vtype]
+                return fn(self.c_mapinfo, ptype)
+            else:
+                return _NUMOF[vtype](self.c_mapinfo)
         else:
             keys = "', '".join(sorted(_NUMOF.keys()))
             raise ValueError("vtype not supported, use one of: '%s'" % keys)



More information about the grass-commit mailing list