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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 26 06:30:24 PDT 2015


Author: huhabla
Date: 2015-08-26 06:30:23 -0700 (Wed, 26 Aug 2015)
New Revision: 66028

Modified:
   grass/trunk/lib/python/pygrass/vector/__init__.py
   grass/trunk/lib/python/pygrass/vector/geometry.py
Log:
pygrass vector: Added to_wkt to Node class


Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py	2015-08-26 12:30:33 UTC (rev 66027)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py	2015-08-26 13:30:23 UTC (rev 66028)
@@ -373,7 +373,7 @@
 
         :param vtype: the name of type to query; the supported values are:
                       *areas*, *dblinks*, *faces*, *holes*, *islands*,
-                      *kernels*, *line_points*, *lines*, *nodes*,
+                      *kernels*, *line_points*, *lines*, *nodes*, *points*,
                       *update_lines*, *update_nodes*, *volumes*
         :type vtype: str
         :param idonly: variable to return only the id of features instead of

Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py	2015-08-26 12:30:33 UTC (rev 66027)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py	2015-08-26 13:30:23 UTC (rev 66028)
@@ -1133,7 +1133,7 @@
 
            param v_id: The unique node id
            param c_mapinfo: A valid pointer to the mapinfo object
-           param **kwords: Ignored 
+           param **kwords: Ignored
         """
         self.id = v_id  # vector id
         self.c_mapinfo = c_mapinfo
@@ -1170,6 +1170,12 @@
                                    ctypes.byref(y), ctypes.byref(z))
         return (x.value, y.value) if self.is2D else (x.value, y.value, z.value)
 
+    def to_wkt(self):
+        """Return a "well know text" (WKT) geometry string. ::
+        """
+        return "POINT(%s)" % ' '.join(['%f' % coord
+                                      for coord in self.coords()])
+
     def ilines(self, only_in=False, only_out=False):
         """Return a generator with all lines id connected to a node.
         The line id is negative if line is ending on the node and positive if



More information about the grass-commit mailing list